We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Position mouse cursor
Page Index Toggle Pages: 1
Position mouse cursor (Read 1133 times)
Position mouse cursor
Sep 14th, 2008, 11:29am
 
Where would I find how to position the mouse cursor at a particular location from inside the program, do something like moveMouseTo(width/2,height/2)?
Re: Position mouse cursor
Reply #1 - Sep 14th, 2008, 11:56am
 
have a look at the "Robot":

http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Robot.html

i think there are some examples somewhere on the discourse here, surely you can find some on the web ...

F
Re: Position mouse cursor
Reply #2 - Sep 14th, 2008, 12:41pm
 
Thank you, F. That works in the LCD coordinate system. Now I need to find the location of the drawing window on the LCD. Or somehow redirect the robot to the drawing window instead of the LCD.
Re: Position mouse cursor
Reply #3 - Sep 14th, 2008, 5:28pm
 
frame.getLocation().getX();

"frame" is a variable of PApplet set to the frame (java.awt.Frame) that contains it.

see:
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Frame.html

F
Page Index Toggle Pages: 1