Specialeffekter och spelutveckling
i Java(TM) - Appleten SleepTest
import java.applet.*;
import java.awt.*;
public class sleeptest extends Applet implements Runnable {
public Thread programtrad = null;
public void start()
{
if (programtrad == null)
{
programtrad = new Thread(this,"programtrad");
programtrad.start();
}
}
public void stop()
{
if ((programtrad != null) && programtrad.isAlive())
programtrad.stop();
programtrad = null;
}
public void run()
{
while (true)
{
showStatus("Länge");
try {Thread.sleep(1000);}
catch(InterruptedException e) {}
showStatus("Leve");
try {Thread.sleep(1000);}
catch(InterruptedException e) {}
showStatus("Java!");
try {Thread.sleep(1000);}
catch(InterruptedException e) {}
}
}
}
} |
 |  |
|