# Java Notes

# MouseMotionListener

Moves and drags. When you move the mouse, the interface generates events very rapidly. If a mouse button is depressed, then this is called a drag. Events from a move or drag are generated very quickly, and can be listed to by adding a mouse motion listener.

## MouseMotionListener methods

To implement a MouseMotionListener, you must define the following methods.

    public void mouseMoved(MouseEvent e) {}
    public void mouseDragged(MouseEvent e) {}

This method is called | When the user does this action
`mouseMoved(...)` | The mouse is moved while over the component.
`mouseDragged(...)` | The mouse is dragged (moved with a button pressed).