Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Robot.mouseMove & Mouse-Motion Listener problem

843807Jun 13 2010 — edited Jun 23 2010
Hi there!

Here is my problem :

I am using a Mouse-Motion Listener. Thanks to this listener, I can catch the movements of the mouse. I have implemented the “mouseMoved(MouseEvent e)” function.

I am using, in my function “mouseMoved(MouseEvent e)”, a Robot (java.awt.Robot) object. I use the method “mouseMove(int x, int y)” of this object to replace the pointer of the mouse (it's the general purpose of my program).

My problem is that this movement created by “mouseMove(int x, int y)” is handled as a normal mouse event by the function “mouseMoved(MouseEvent e)” so these two functions start an “infinite loop”.

Do you know how I can proceed to avoid this “infinite loop” ?

Thank you for your help,
Sam
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 21 2010
Added on Jun 13 2010
4 comments
3,175 views