Every event has a source object, obtained by getSource(), and a type value, obtained by getID(). In the case of buttons, the ID is ACTION_PERFORMED. Other Events may have more than one type of event ID. |
Event subclasses also have methods for whatever data is needed to handle the event. For example, ActionEvent has a method paramString() which for buttons, returns the string labelling the button. MouseEvent has methods getX() and getY(), which return the x and y pixel location of the mouse, and getClickCount(). |
AWTEvent |
ActionEvent |
InputEvent |
Adjustment |
Event |
ItemEvent |
ComponentEvent |
MouseEvent |
KeyEvent |
. . . |