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


1 These applet start and stop methods can always be used to start and stop the thread.
2 import java.awt.*;
3 import java.util.Date;
4 public class DigitalClock extends java.applet.Applet
5 implements Runnable
6 { Font theFont = new Font("TimesRoman", Font.BOLD, 24);
7 Date theDate;
8 Thread runner;
9 public void start ( )
10 { if (runner == null)
11 { runner = new Thread(this); runner.start ( ); }
12 }
13 public void stop ( )
14 { if (runner != null)
15 { runner.stop ( ); runner = null; }
16 }

in Table To:


© 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