Mouse Events
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