Java
Programming
Event Handling
- Listener Interfaces
Any
class which handles events must implement a listener interface for the event
type it wishes to handle. A class can
implement any number of listener interfaces.
To implement a listener interface the class must implement every method
in the interface. Here is a list of
interfaces and their methods:
Listener Interface Methods
ActionListener actionPerformed(ActionEvent
e)
AdjustmentListener adjustmentValueChanged(AdjustmentEvent
e)
ComponentListener componentResized(ComponentEvent e)
componentMoved(ComponentEvent
e)
componentShown(ComponentEvent
e)
componentHidden(ComponentEvent
e)
ContainerListener componentAdded(ContainerEvent e)
componentRemoved(ContainerEvent
e)
FocusListener focusGained(FocusEvent
e)
focusLost(FocusEvent
e)
ItemListener itemStateChanged(ItemEvent
e)
KeyListener keyTyped(KeyEvent
e)
keyPressed(KeyEvent
e)
keyReleased(KeyEvent
e)
MouseListener mouseClicked(MouseEvent
e)
mousePressed(MouseEvent
e)
mouseReleased(MouseEvent
e)
mouseEntered(MouseEvent
e)
mouseExited(MouseEvent
e)
MouseMotionListener mouseDragged(MouseEvent e)
mouseMoved(MouseEvent
e)
TextListener textValueChanged(TextEvent
e)
WindowListener windowActivated(WindowEvent e)
windowClosed(WindowEvent
e)
windowClosing(WindowEvent
e)
windowDeactivated(WindowEvent
e)
windowDeiconified(WindowEvent
e)
windowIconified(WindowEvent
e)
windowOpened(WindowEvent
e)