The Java Listener Interfaces and their Methods

(from Flannigan, Java in a Nutshell, 2nd Edition)

 

INTERFACE

INTERFACE METHODS

ADD METHOD

EVENT CLASS
ActionListener actionPerformed (ActionEvent) addActionListener() ActionEvent
       
AdjustmentListener adjustmentValueChanged(AdjustmentEvent) addAdjustmentListener() AdjustmentEvent
       
ComponentListener componentHidden(ComponentEvent) addComponentListener() ComponentEvent
  componentMoved(ComponentEvent)    
  componentResized(ComponentEvent)    
  componentShown(ComponentEvent)    
       
ContainerListener componentAdded(ComponentEvent) addContainerListener() ContainerEvent
  componentRemoved(ComponentEvent)    
       
FocusListener focusGained(FocusEvent) addFocusListener() FocusEvent
  focusLost(FocusEvent)    
       
ItemListener itemStateChanged(ItemEvent) addItemListener() ItemEvent
       
KeyListener keyPressed(KeyEvent) addKeyListener() KeyEvent
  keyReleased(KeyEvent)    
  keyTyped(KeyEvent)    
       
MouseListener mouseClicked(MouseEvent) addMouseListener() MouseEvent
  mouseEntered(MouseEvent)    
  mouseExited(MouseEvent)    
  mousePressed(MouseEvent)    
  mouseReleased(MouseEvent)    
       
MouseMotionListener mouseDragged(MouseEvent) addMouseMotionListener() MouseEvent
  mouseMoved(MouseEvent)    
       
Text:Listener textValueChanged(TextEvent) addText:Listener() TextEvent
       
WindowListener windowActivated(WindowEvent) addWindowListener() WindowEvent
  windowClosed(WindowEvent)    
  windowClosing(WindowEvent)    
  windowDeactivated(WindowEvent)    
  windowDeiconified(WindowEvent)    
  windowIconified(WindowEvent)    
  windowOpened(WindowEvent)    

 

AWT Components and the Events they Generate

Button ActionEvent User clicked the button
Checkbox ItemEvent User selected or deselected an item
CheckboxMenuItem ItemEvent User selected or deselected an item
Choice ItemEvent User selected or deselected an item
Component ComponentEvent Component moved, resized, hidden, or shown
  FocusEvent Component gained or loast focus
  KeyEvent User pressed or released a key
  MouseEvent User pressed or released a mouse button, mouse entered or exited a component, or user moved or dragged mouse.
Container ContainerEvent Component added to or removed from Container
List ActionEvent User double-clicked on a List item
  ItemEvent User selected or deselected an item
MenuItem ActionEvent User selected a menu item
ScrollBar AdjustmentEvent User moved the scrollbar
TextComponent TextEvent User changed the text
TextField ActionEvent User pressed Enter (finished editing text)
Window WindowEvent Window opened, closed, iconified, deiconified, or close requested

Event Masks and their Methods

MASK METHOD
AWTEvent.ACTION_EVENT_MASK processActionEvent()
AWTEvent.ADJUSTMENT_EVENT_MASK processAdjustmentEvent()
AWTEvent.COMPONENT_EVENT_MASK processComponentEvent()
AWTEvent.CONTAINER_EVENT_MASK processContainerEvent()
AWTEvent.FOCUS_EVENT_MASK processFocusEvent()
AWTEvent.ITEM_EVENT_MASK processItemEvent()
AWTEvent.KEY_EVENT_MASK processKeyEvent()
AWTEvent.MOUSE_EVENT_MASK processMouseEvent()
AWTEvent.MOUSE_MOTION_EVENT_MASK processMouseMotionEvent()
AWTEvent.TEXT_EVENT_MASK processEventEvent()
AWTEvent.WINDOW_EVENT_MASK processWindowEvent()