aspose file tools*
The moose likes Beginning Java and the fly likes please help ...urgent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "please help ...urgent" Watch "please help ...urgent" New topic
Author

please help ...urgent

Ash sav
Ranch Hand

Joined: Apr 14, 2001
Posts: 55
import java.applet.Applet;
import java.awt.*;
/*
< applet code = FlashingLight.class height = 265 width=90>
< /applet>
*/

When I try to see the applet it's working fine the way i want but I don't know how to stop the applet. If I click on close then applet hangs for seconds. Can somebody tell me how can I prevent that?

[This message has been edited by Cindy Glass (edited August 21, 2001).]
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Ash,
Instead of using for loops to wait why not just use the Thread.sleep(...) method. You can place it inside a try/catch block so that you can catch the InterruptedException and exit cleanly. That might stop your major delay ...

Regards,
Manfred.
Ash sav
Ranch Hand

Joined: Apr 14, 2001
Posts: 55
import java.applet.Applet;
import java.awt.*;
/*
< applet code = FlashingLight.class height = 265 width=90>
< /applet>
*/

Hi Manfred,
According to your suggestion i replace the code with try catch block but when i click on close icon applet still hangs. Can you tell me what's wrong?
Thanks,
Ash
[This message has been edited by Cindy Glass (edited August 21, 2001).]
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Ash,
Your problem might not have been the for loops after all ... When I run your code I noticed that your while loop is chugging away filling in the event queue with drawing commands. When you hit stop your quit event is placed in the queue. Unfortunatly it has to wait until all the drawing commands are completed first. I think each drawing command might be starting up a new drawing thread which is why the while loop can continue to chug even though the drawing is not being completed. I am drawing a blank right now on how to fix the problem though ...
Sorry,
Manfred.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: please help ...urgent