Class Sticks

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----java.applet.Applet
                                   |
                                   +----Sticks

public class Sticks
extends Applet
implements Runnable
This extension to the Applet class bounces lots of lines around. The size of the box is specified by the 'width' and 'height' values in the applet tag.

Constructor Index

 o Sticks()

Method Index

 o init()
Applet initialisation routine
 o run()
The main thread of execution.
 o start()
Called each time the browser displays the page.
 o stop()
Called each time the browser leaves the page.

Constructors

 o Sticks
  public Sticks()

Methods

 o init
  public void init()
Applet initialisation routine
Overrides:
init in class Applet
 o start
  public void start()
Called each time the browser displays the page. For each thread we may have, check if there isn't one running. Create one if necessary and and start it up.
Overrides:
start in class Applet
 o stop
  public void stop()
Called each time the browser leaves the page. Junk any threads that may be running.
Overrides:
stop in class Applet
 o run
  public void run()
The main thread of execution. While we have a running thread, update the display, sleep for the specified time and go round again. Note that we draw directly onto the Applet's display area (obtained using the getGraphics() method). This is because with lots of independent threads moving lines around, we can't do the drawing in a single paint routine (which is in fact called within a Java System thread).