| | | Images and Active Objects - putting it all together |
Images and Active Objects - putting it all together
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 lab, which is coming up soon!.
| | | Images and Active Objects - putting it all together |