Example showing thread methods, continued
The body of the applet is in the run method, in this case a loop to keep showing the date.
{ Thread thisThread = Thread.currentThread();
// loop as long as thread is defined while runner == thisThread)
{ theDate = new Date ( );
try { thisThread.sleep ( 1000); }
catch ( InterruptedExecution e) { }
public void paint ( Graphics g )
g.drawString ( theDate.toString ( ), 10, 50 );