The AWT event model changed dramatically between Java 1.0 and 1.1. Chapter 11 described the Java 1.1 event-handling model exclusively, since the Java 1.0 event model is now deprecated. However, because there is still a (dwindling) installed base of web browsers that support only the Java 1.0 event model, applets are sometimes still written using this model. This section briefly describes Java 1.0 event handling and includes an example applet that uses the model.
In Java 1.0, all events are represented by the
java.awt.Event class. This class has a
number of instance fields that describe the event. One of these
id, specifies the type of
Event defines a number
of constants that are the possible values for the
id field. The
target field specifies the object (typically
Component) that generated the
event, or on which the event occurred (i.e., the source of the event).
The other fields may or may not be used, depending on the type of the
event. For example, the
y fields are defined when
BUTTON_EVENT, but not when it is
arg field can provide additional
Java 1.0 events are dispatched first to the
handleEvent( ) method of the
Component on which they occurred. The
default implementation of this method checks the
id field of the
Event object and dispatches the most
commonly used types of events to various type-specific methods, listed
in Table 16-1.
Table 16-1. Java 1.0 event-processing ...