Events

An event is something that happens to an object—the click of a mouse button within its bounds, or the tick of a timer, for example. Java 1.1 introduced a new event model based on delegation. In essence, an object’s class definition declares that it fires a certain event; other objects in the program can then make known their interest in listening to that event. This focuses the management of events on what is happening and who wants to do something about it, allowing program flow to be structured in a very object-oriented fashion. Beans depend on the Java 1.1 event delegation model. The following example demonstrates this model.

© 1997 by Scott Ladd. All rights reserved.