Elements of the Previous Examples to Note
- the method getSize() to get the dimensions of the traffic
light canvas that was assigned by the layout manager.
- the Dimension class
- the methods getColor() and setColor()
- the methods drawOval() and fillOval()
- the methods getMinimumSize() and getPreferredSize
that are used by some of the layout managers to help determine the
size of components
In the class ChangeableTL, note the use of
- Static named constants
- Event handlers in two different classes. Which goes where and why?
- Use of the public Event instance variables e.target,
e.x, and e.y
- Casting an Object, e.target, to a ChangeableTL. Why is this
necessary? Why doesn't polymorphism take care of this?