TopDrawable ImagesImages and Active Objects - putting it all together

Images and Active Objects - putting it all together

First a quick example of how to make the animated banner on my home page:

Demo. Binary Banner.

We are now ready to examine the code for our example with falling leaves.

Demo. Falling Leaves.

The code shown with the demo includes the class Fall which extends WindowController. While it includes code for loading the images of the leaves, and draws the background picture, the only indication that something interesting is going on is in the method onMouseClick. Each time the mouse is clicked, a new object of type Tree is created. Obviously this tree object is responsible for the cascade of leaves which show up on the screen. In fact we see that the images of leaves are passed along to the Tree constructor. Understanding the way this works is key to being able to write programs like the Frogger (next week's lab!).


TopDrawable ImagesImages and Active Objects - putting it all together