moomoohk
moomoohk

Reputation: 493

How can i make a MouseMotionListener detect the end of a drag?

I have a MouseMotionListener and in the mouseDragged method I have a boolean that turns to true. The problem is I have no idea how to get it to turn back to false once the drag is over. Is there a way to do this? Any help is appreciated.

Upvotes: 3

Views: 2707

Answers (1)

Baz
Baz

Reputation: 36894

for SWT: you could add a MouseListener with the method public void mouseUp(MouseEvent arg0) and set the boolean to false. See here: MouseListener Example

Or if you use swing, this is helpful (with public void mouseReleased(MouseEvent e)): MouseListener

Upvotes: 3

Related Questions