Bouncing Ball
SAMPLE APPLET:
Similar EXAMPLE
ASSIGNMENT: You will need to study the following code
carefully!!! Here is what you should do:
- Get the sample running
- Notice the implements Runnable and the run methods. Figure out what the
variables are for (especially xDir, incr, and sleepFor).
- Understand why and when the ball changes directions. (That's the if
statement in the run method ... the || means OR.)
- Alter this applet so the ball moves up and down (in a tall and skinny
applet area).