Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

please help ...urgent

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
What kind of corn soldier are you? And don't say "kernel" - that's only for this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic