Home Java Java-tips GUI-lowlevel Mouse MouseMotionListener

Ask Questions?

View Latest Questions



Posted on: July 26, 2006 at 12:00 AM
To implement a MouseMotionListener

Java Notes


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).
Copyleft 2003 Fred Swartz MIT License, Last update: 2002-04-08