| | | Summary of objects & classes |
Summary of objects & classes
We have now seen three different kinds of objects/classes:
- Objects that inherit graphicApplication. They
pop up the graphics window, have access to the canvas and may
contain methods (such as onMouseClick(Location point)) to
respond to mouse events.
- Classes that don't extend anything. They take parameters
that are used to initialize defs and
variables necessary to represent objects. They may contain any methods necessary.
Examples include Tshirt, Magnet, etc.
- Classes that represent animations. They import "animation",
typically include a start method that includes a looping
construct of the form animator.whilepausing()do{}finally{}
They also require parameters and contain code to do initialization.
The rest of the program continues execution while the animator
loops repeatedly.
Objects are created from these classes as usual, but you must then send
them a start method request to get the animation started.
See the dripping paint example, which is very much like the tree from the
previous lecture:
Demo. Dripper.
| | | Summary of objects & classes |