CS 245
Oct. 10, 2008
Bounce1.java
from the class Web page. Compile and
run it. Notice that you can start the bouncing ball, but you can't stop
the bouncing ball.
Looking through the code, explain exactly why the applet doesn't respond to a click on the stop button.
Notice how long it takes for the applet viewer to go away when you terminate it.
Bounce2.java
from the class Web page. Compile and
run it.
draw()
in
Ball
's run()
method? (You may need to go through several
start/stop cycles before you notice any changes.)
actionPerformed()
to learn how the animated ball is
started and stopped.
You might find the following useful:
Ball[] balls = new Ball[20]; ... balls[i] = new Ball(display, Color.green);