
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
424
|
Chapter 19: The Delegation Event Model
Event source
An object that notifies other objects of some specific occurrence (i.e., some
event)
Event listeners
The objects that are notified by the event source when an event occurs
Event object
An object that describes the nature of the event
An event is any predetermined occurrence that the event source considers significant
enough to tell other objects about—anything from the clicking of the mouse to the
ending of a game to the submission of an order form. To notify an event listener of an
event, the event source invokes an agreed-upon method on it. The event object is
passed to the agreed-upon method by the event source, giving the event listener
access to information about the event.
In a minimal delegation event model implementation, the event source, event listen-
ers, and event object participants break down into the classes and interfaces
described in the following sections.
The Event Source
The event source includes the following classes:
Event source class
The class whose instances broadcast events to event listeners (the class can have
any name)
EventListenerList
A utility class used by the event source to manage event listeners
The EventListenerList class resides in the event package, but the event source class
can reside in any package. ...