EVENT CLASSES
The classes that represent events are the core of java’s event handling mechanism .
thus we begin our study of event handling with a tour of the event classes .As our will see,they provide a consistent ,easy-to-use means of encapsulatating events.
At the root of java event class hierarchy is Eventobject, which is in java .util.It
Is the superclass for all events.its one constructor is show here
EventObject(Object src)
Here , src is the object that generates this event.
EventObject contain two methods: getsource() & toString().The getsource() method return the source of events . its general form show here:
Objectgetsource()
As expected string() return the string equivalent of the event
The class AWTEvent , define with in the java.awt package , is a subclass of EventObject.it is the superclass(either directly or indirectly) of all AWT-based event used by the delegation event model.its getID() method can be used ti determine the type of the event .the signature of this method is show here
Int getID()
At this point , it is important to know only that all of the other classes discusses in this section are subclasses of AWTEvent.
TO SUMMARIZE:
EventObject is a superclass of all event
AWTEvent is a superclass os all AWT event that are handled by the delegation event model.
The package java.awt.event define several types of event that are generated by various user interface elements .the table below enumerates the most important of these event classes & provide a breif description of when they are generated .The most commonly
used constructors,
EVENT ClASS DESCRIPTION
ACTIONEVENT Generated whan a button is presses,a list item
is double-clicked or a menu item is selected .
AdjustmentEvent Generated when a scroll bar is mainuplated.
ComponentEvent Generated when a component is hidden,moved,resizes,
Or become visible.
ContainerEvent Generated when a component is added to removes from a
Container.
FocusEvent Generated when a component gains or loses keyboard focus.
InputEvent Abstract super class for all component input event classes.