I hope YOU made the applet.
You probably extended the applet with Runnable, and will therefore also (probably) use Threads....
You should override the Thread-methods.
public void start()
public void run()
public void stop()
the stop part is where you need to add code (and even more additional code for NS!) like:
Thread killThread;
public class KillThread extends Thread
{
Applet parent;
final int KILLTHREADINTERVAL = 5000; // 5 seconds
public KillThread (Applet p)
{
super("killThread");
parent = p;
}
public void run ()
{
try
{
sleep(KILLTHREADINTERVAL);
}
catch (InterruptedException e) {}
parent.destroy();
}
}
public void destroy()
{
if (thMusic != null)
{
thMusic.stop();
thMusic = null;
}
if (killThread != null)
{
killThread.stop();
killThread = null;
}
}
public void stop()
{
if((MyThread!=null) && (MyThread.isAlive()))
{
thMusic.suspend();
}
if (killThread != null)
System.out.println ("ERROR - killThread shouldn't exist");
else
{
killThread = new KillThread(this);
killThread.start();
}
}
Which will in general check for when the stop method is called, and then creates a new thread which will keep it alive for some more time (for NS)...and if that one expires will THEN get rid of everything....
I hope that helped a bit...
regards,
CJ
Main Topics
Browse All Topics





by: mplungjanPosted on 2000-08-31 at 01:52:05ID: 4139731
Can we see that in action, please???
t.finish() "
You may want to do
onUnload="document.myApple
where finish is a public method that cleans up, but I have never heard of this happening before
Michel