Swing Events, Listeners, and Methods


Event Types

   User Action   Source Object    Generated Event
Click a button JButton ActionEvent
Return on a text field JTextField ActionEvent
Select new item JComboBox ItemEvent, ActionEvent
Select item JList ListSelectionEvent
Click check box JCheckBox ItemEvent, ActionEvent
Click radio button JRadioButton ItemEvent, ActionEvent
Select menu item JMenuItem ActionEvent
Move scroll bar JScrollBar AdjustmentEvent
Window opened or closed Window WindowEvent
Add or remove from container Container ContainerEvent
Moved, resized, hidden Component ComponentEvent
Focus change Component FocusEvent
Key action Component KeyEvent
Mouse button, entry, exit Component MouseEvent
Mouse motion Component MouseEvent

Event Listeners

   Event Class   Listener Interface    Listener Methods (Handlers)
ActionEvent ActionListener actionPerformed (ActionEvent)
ItemEvent ItemListener itemStateChanged (ItemEvent)
WindowEvent WindowListener windowClosing (WindowEvent)
windowOpened (WindowEvent)
windowIconified (WindowEvent)
windowDeiconified (WindowEvent)
windowClosed (WindowEvent)
windowActivated (WindowEvent)
windowDeactivated (WindowEvent)
ContainerEvent ContainerListener componentAdded (ContainerEvent)
componentRemoved (ContainerEvent)
ComponentEvent componentMoved (ComponentEvent)
componentHidden (ComponentEvent)
componentResized (ComponentEvent)
componentShown (ComponentEvent)
FocusEvent FocusListener focusGained (FocusEvent)
focusLost (FocusEvent)
KeyEvent KeyListener keyPressed (KeyEvent)
keyReleased (KeyEvent)
keyTyped (KeyEvent)
MouseEvent MouseListener mousePressed (MouseEvent)
mouseReleased (MouseEvent)
mouseEntered (MouseEvent)
mouseExited (MouseEvent)
mouseClicked (MouseEvent)
MouseMotionListener mouseDragged (MouseEvent)
mouseMoved (MouseEvent)
AdjustmentEvent AdjustmentListener adjustmentValueChanged (AdjustmentEvent)