Basic HTML version of Foils prepared Sept 21 1998

Foil 12 Example showing the standard thread methods

From Java Tutorial 98- 3: Graphics and the Abstract Windowing Toolkit NAVO Tutorial -- Sept 23 1998. by Geoffrey C. Fox, Nancy McCracken


These applet start and stop methods can always be used to start and stop the thread.
import java.awt.*;
import java.util.Date;
public class DigitalClock extends java.applet.Applet
implements Runnable
{ Font theFont = new Font("TimesRoman", Font.BOLD, 24);
Date theDate;
Thread runner;
public void start ( )
{ if (runner == null)
{ runner = new Thread(this); runner.start ( ); }
}
public void stop ( )
{ if (runner != null)
{ runner.stop ( ); runner = null; }
}



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Nov 28 1998