Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run when minimized

Status
Not open for further replies.

abp

Programmer
Sep 14, 2000
134
FR
Hi,

I am a newbie to Java programming so excuse me if this
question is stupid :).

I want to know how to make a Java Applet run when its window is minimized. I have a clock application which stops when I minimize its window.

Thanks a lot,

abp
 
Hi,

Erm...applets are always running even when minimised? I don't understand why it isn't running while minimised. Perhaps you would like to display the codes of the applet?

Regards,
Leon If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best :)
 
Leon.

Thanks for reply. What I have is a JAVA3D applet which can be run as application also.
(Using MainFrame() ). It uses an array of Lines to display a running digital clock to the
screen. I note that when I minimize the app and then restore it sometime later the time
is stuck in the time when I minimized...

This is an app which responds to a time stimulus every second to update its display
and hence make the clock tick. So it needs to be running all the time...not when
the user opens the window.

The code is pretty big, about 500 lines. I could post it if you want. Anyway here is
the code that converts the applet to an application. Please tell me if I need to add
some extra code here ...

public static void main(String[] args) {
new MainFrame( new DigitalClockApp(), 256, 256);
}

DigitalClockApp is my java class that does the work.

Thanks again,

abp :cool:
 
Leon.

Thanks for reply. What I have is a JAVA3D applet which can be run as application also.
(Using MainFrame() ). It uses an array of Lines to display a running digital clock to the
screen. I note that when I minimize the app and then restore it sometime later the time
is stuck in the time when I minimized...

This is an app which responds to a time stimulus every second to update its display
and hence make the clock tick. So it needs to be running all the time...not when
the user opens the window.

The code is pretty big, about 500 lines. I could post it if you want. Anyway here is
the code that converts the applet to an application. Please tell me if I need to add
some extra code here ...

public class DigitalClockApp extends Applet {

...
...
...
public static void main(String[] args) {
new MainFrame( new DigitalClockApp(), 256, 256);
}
}
/* end of class DigitalClockApp */

DigitalClockApp is my java class that does the work.

Thanks again,

abp :cool:
 
Hi,

I don't know what you have within the constructor of your MainFrame class so I don't know what codes you lack of.

For your clock, perhaps it will be better if you send me the codes? 500 lines seem abit too long. I haven't actually programmed with Java3D before but have downloaded and installed it into my pc... too lazy to begin on it. Perhaps it is the time I will start playing around with it :)

I will see what I can do about it.

Regards,
Leon If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best :)
 
Hi Leon,

I shall try mailing the code at zaoliang@hotmail.com.
It consists of 3 files each which defines 3 classes. You need
to have j3d installed and the paths set to run them.

Thanks a lot for your help!!

abp :)
 
Hi,

I can't get the error you are talking about. I have tried minimising the browser for 5 - 30 seconds but it is still running properly.

I have tested out using IE5.0 and Netscape4.6 . Perhaps if you are using an older version of IE or Netscape, your browser doesn't fully support the Java3D? Or maybe you want to try reinstalling Java3D? Maybe some little error happened while you are installing the Java3D pacakage?

Regards,
Leon If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best :)
 
Hi Leon

The problem is not with applet running in browser.
You can run the applet as an application by 'java DigitalClockApp'. If you minimize this applet window the program stops working.

abp :cool:
 
Hi All,

I posted this query in the Java3D interest group and got the following
answer from a J3D developer at Sun.

-------------------------------------------------------------
Current implementation will stop Behavior scheduler
when window iconified to free CPU doing other OS task.

Under Netscape/IE, however, window listener of
fail to receive windowIconified() notification
(It is a bug) so Behavior scheduler did not stop as expected.

- Kelvin
-----------------------------------------------------------------

I am posting it here so it could be useful to other J3D developers.

Leon, thanks for all your help!

Regards

Anand
 
Hi anand,

Thanks for informing us. But I don't quite get it. Is it suppose to be a bug for the clock to keep on running when minimised in a browser? Doesn't sounds logical...

Leon If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best :)
 
I think that the windowlistener for the applet doenst
get the message that the parent window(in this case IE/Netscape) was iconified (WindowEvent.WINDOW_ICONIFIED)
hence it fails. Is there any method in Applet class that
one can override to implement this behavior ... I know
about init() and destroy() which responds to (i think!)
to window activate/window destroy events but how about
window iconified.

Thanks

Anand ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mail me at abpillai@excite.com if you want additional help. I dont promise that I can solve your problem, but I will try my best.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top