In Java, I want to get the amount the mouse moved during the mouseMoved()
event in the MouseMotionListener
. I know the point given by the MouseEvent is where the mouse position is at that exact moment. Must I store a mouse position variable that is the previous mouse position? I would have to update it every time the mouse moved, or is there a better way?
Asked
Active
Viewed 173 times
0

MCMastery
- 3,099
- 2
- 20
- 43
-
The question is not clear properly. Can you give an example what are you trying to achieve? – Anirban Nag 'tintinmj' Jun 27 '15 at 21:14
-
Yes, you must store the previous position somewhere. – Vince Jun 27 '15 at 21:15
-
I want the position the mouse was at the exact moment before the mouse move event occurs – MCMastery Jun 27 '15 at 21:15
-
For [example](http://stackoverflow.com/a/5312702/230513). – trashgod Jun 27 '15 at 21:15
-
1*"Must I store a mouse position...*" - Yes – MadProgrammer Jun 27 '15 at 21:22