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
-
Stick()
-
-
init()
-
Applet initialisation routine
-
run()
-
The main thread of execution.
-
start()
-
Called each time the browser displays the page.
-
stop()
-
Called each time the browser leaves the page.
-
update(Graphics)
-
Display update method.
Stick
public Stick()
init
public void init()
- Applet initialisation routine
- Overrides:
- init in class Applet
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
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
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.
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