Basic HTML version of Foils prepared Sept 21 1998

Foil 41 Mouse Events

From Java Tutorial 98- 3: Graphics and the Abstract Windowing Toolkit NAVO Tutorial -- Sept 23 1998. by Geoffrey C. Fox, Nancy McCracken

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 Sat Nov 28 1998