GrowableBallBouncer

This program draws a bunch of basketballs on the screen so that we can watch them bounce randomly. Each click adds a ball to the display. Leaving the canvas makes the balls temporarily vanish. Moving the mouse back into the canvas makes the balls reappear and bounce for a while. It demonstrates the use of an array to keep track of a variable number of objects.

Note: This demo requires a Java enabled browser. If you see this message then your browser either doesn't support Java or has had Java disabled.

Click below to download the source files for GrowableBallBouncer.