why swing creators created mouseDragged method?

82 Views Asked by At

I always thought that difference between mouseMoved and mouseDragged is that you could get the button pressed in the mouseDragged event. Apparently, you can't, as I just found out. So what is the reason including/using mouseDragged method? Because as for now all my code looks like this:

@Override
public void mouseDragged(MouseEvent e) {

            mouseMoved(e);

}
1

There are 1 best solutions below

2
On BEST ANSWER

The mouseMoved() method is called when the user moves the mouse with no buttons pressed. The mouseDragged() method on the other hand is called when the user moves the mouse while holding down a mouse button.

Check out this page for more information.