CIS 35A: Introduction to Java Programming

Home | Green Sheet | Lectures | Assignments | FAQ | Grades

Events

Events
Code low-level events
Summary

Common low-level events and listeners

Event Interface Methods
Moving the focus FocusListener void focusLost(FocusEvent e)
void focusLost(FocusEvent e)
Pressing or releasing a key KeyListener void keyPressed(KeyEvent e)
void keyReleased(KeyEvent e)
void keyTyped(KeyEvent e)
Moving or dragging the mouse MouseMotionListener void mouseDragged(MouseEvent e)
void mouseMoved(MouseEvent e)
Clicking the mouse MouseListener void mouseClicked(MouseEvent e)
void mouseEntered(MouseEvent e)
void mouseExited(MouseEvent e)
void mousePressed(MouseEvent e)
void mouseReleased(MouseEvent e)
Moving or sizing a component ComponentListener void componentHidden(ComponentEvent e)
void componentMoved(ComponentEvent e)
void componentResized(ComponentEvent e)
void componentShown(ComponentEvent e)
Working with the window WindowListener void windowActivated(WindowEvent e)
void windowClosed(WindowEvent e)
void windowClosing(WindowEvent e)
void windowDeactivated(WindowEvent e)
void windowDeiconified(WindowEvent e)
void windowIconified(WindowEvent e)
void windowOpened(WindowEvent e)

Methods that add low-level listeners

Event source Method
Component addFocusListener(FocusListener)
Component addKeyListener(KeyListener)
Component addMouseMotionListener(MouseMotionListener)
Component addMouseListener(MouseListener)
Component addComponentListener(ComponentListener)
Window addWindowListener(WindowListener)
Previous | Summary | Focus | Keyboard | Adapter | Next