Special Effects and Game Development
in Java(TM) - The Applet ThreadTest
import java.applet.*;
import java.awt.*;
public class threadtest extends Applet implements Runnable {
public Thread animationthread = null;
public void start()
{
if (animationthread == null)
{
animationthread = new Thread(this,"animationthread");
animationthread.start();
}
}
public void stop()
{
if ((animationthread != null) && animationthread.isAlive())
animationthread.stop();
animationthread = null;
}
public void run()
{
while (true)
{
showStatus("Hello Sweden!");
}
}
} |
| |
|