Java Reference
In-Depth Information
5 . Briefly explain Java's delegation event model.
In the delegation event model, a source generates an event and sends it to one or
more listeners . A listener simply waits until it receives an event. Once received, the
listener processes the event and then returns.
6 . Must an event listener register itself with a source?
Yes; a listener must register with a source to receive events.
7 . Extra challenge: Another of Java's display methods is drawLine( ) . It draws a line in
the currently selected color between two points. It is part of the Graphics class.
Using drawLine( ) , write a program that tracks mouse movement. If the button is
pressed, have the program draw a continuous line until the mouse button is released.
Search WWH ::




Custom Search