Showing posts with label Action event. Show all posts
Showing posts with label Action event. Show all posts

Monday, 3 February 2014

Event Classes in java

The classes that represent events are at the core of Java’s event handling mechanism......

Event Classes

The classes that represent events are at the core of Java’s event handling mechanism. At the root of the Java event class hierarchy is EventObject, which is in java.util. EventObject contains two methods: getSource( ) and toString( ). 

The getSource( )method returns the source of the event. Its general form is shown here:

        Object getSource( )

As expected, toString( )returns the string equivalent of the event.The class AWTEvent, defined within the java.awt package, is a subclass of EventObject.It is the superclass (either directly or indirectly) of all AWT-based events used by the delegation event model. Its getID()method can be used to determine the type of the event. 

The signature of this method is shown here:

         int getID()