Handling Mouse Motion

component.addMouseMotionListener(new MyMouseMotionListener()); public class MyMouseMotionListener extends MouseMotionAdapter { public void mouseMoved(MouseEvent evt) { // Process current position of cursor while all mouse buttons are up. process(evt.getPoint()); } public void mouseDragged(MouseEvent evt) { // Process current position of cursor while mouse button is pressed. process(evt.getPoint()); } }

Post a comment

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.