| Interfaces, GUIs, and Applets | CS 161 - Java |
Every time the user types a character or pushes a mouse button, an event occurs. Any object can be notified of the event. All it has to do is implement the appropriate interface and be registered as an event listener on the appropriate event source.
from: The Java Tutorial, Campione & Walrath, 1999
// create user interface ... // tell user interface components which objects are interested in things // that happen to them ... while (true) { letThingsHappen(); // user interface components will tell interested objects about the // happenings }
|
jwd |