111.Sun的数字时钟Applet: 线索说明 -- II
public void run () {
while (true) {
repaint ();
try { runner.sleep(1000);
} catch (InterruptedException e) {}
} // end while
} // end run()
public void paint (Graphics g) {
Date now = new Date ();
g.drawString (now.getHours() + ":"+ now.getMinutes() + ":"+now.getSeconds(), 5, 10);
}
public void stop () {
if (runner != null)
{runner.stop();runner=null;}
}
} // End Digital Clock Applet
Copyright: NPACT