Basic HTML version of Foils prepared 13 October 97

Foil 41 Mouse Events

From Java Tutorial, July 1, 1996 CSC499(JSU) CPS406/606 -- Fall Semester 97. by Nancy J. McCracken,Geoffrey C. Fox

API for class MouseEvent
There are seven different MouseEvents, handled by methods in both the MouseListener and the MouseMotionListener interfaces.
  • MouseListener:
    • public void mousePressed (MouseEvent e)
    • called when the mouse button is pressed with the cursor in this component
    • public void mouseClicked (MouseEvent e)
    • called when the mouse button is pressed and released without moving the mouse
    • public void mouseReleased (MouseEvent e)
    • called when the mouse button is let up after dragging
    • public void mouseEntered (MouseEvent e)
    • called when the mouse cursor enters the bounds of the component
    • public void mouseExited (MouseEvent e)
    • called when the mouse cursor leaves the component
  • MouseMotionListener
    • public void mouseDragged (MouseEvent e)
    • called when the mouse is moved while the button is held down
    • public void mouseMoved (MouseEvent e)
    • called when the mouse cursor moves



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed Apr 1 1998