Class Stick

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

public class Stick
extends Applet
implements Runnable
This extension to the Applet class bounces a line around in a box. The size of the box is specified by the 'width' and 'height' values in the applet tag.
Version:
0.1, 31-Jul-1996
Author:
Dave Wylie

Constructor Index

 o Stick()

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.
 o update(Graphics)
Display update method.

Constructors

 o Stick
  public Stick()

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. If we haven't got a running thread, then create one, and call start it up.
Overrides:
start in class Applet
 o stop
  public void stop()
Called each time the browser leaves the page. Stop and junk any thread 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.
 o update
  public void update(Graphics g)
Display update method. We overwrite the existing line in black, check if we need to bounce the either endpoint, move the endpoints and draw a new line in white.
Parameters:
g - Graphics context we are to draw the text in
Overrides:
update in class Component