
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Structure and Participants
|
425
The Event Object
The event object includes the following classes:
EventObject
A foundation class that provides basic services for all event objects
A subclass of EventObject
Describes a specific event
The EventObject class resides in the event package (along with the EventListenerList
class), but the EventObject subclass can reside in any package. The event object
describes an event. That is, the object stores information about the event in its prop-
erties, which it makes accessible either directly or via accessor methods. The event
object also provides event listeners with a reference to the event source.
In our Chat class example, the EventObject subclass might be called ChatEvent.It
would define the following properties:
messageText, messageSender, oldUserName, and
newUserName.
The Event Listener
The event listener includes (at least) two interfaces and one class:
EventListener
A marker interface that all event listener interfaces must extend (a marker inter-
face is simply an empty interface that does not define any methods and is used
for the sake of semantics only; see Chapter 8)
EventListener subinterface
A subinterface that catalogs the event source’s events
The event listener class
A class that implements the EventListener subinterface
The EventListener ...