943,872 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 2130
  • Java RSS
Aug 29th, 2008
0

Robot class won't click the mouse

Expand Post »
I have this code:
Java Syntax (Toggle Plain Text)
  1. try
  2. {
  3. robot = new Robot();
  4. robot.mouseMove(0,900);
  5. robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
  6. robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
  7. }catch(Exception e){}
And I want it to click the "Start" button on Windows computers. The mouse moves to the correct location, but does not click. Advice?
Reputation Points: 12
Solved Threads: 2
Posting Whiz
Ghost is offline Offline
352 posts
since Aug 2004
Aug 29th, 2008
0

Re: Robot class won't click the mouse

it appears that Robot only works on swing buttons, and applications
Reputation Points: 73
Solved Threads: 22
Posting Pro in Training
sciwizeh is offline Offline
423 posts
since Jun 2008
May 3rd, 2009
0

Re: Robot class won't click the mouse

Click to Expand / Collapse  Quote originally posted by sciwizeh ...
it appears that Robot only works on swing buttons, and applications
This is not true. Although this is what it was primarily intended.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Geazie is offline Offline
1 posts
since May 2009
Dec 3rd, 2009
0
Re: Robot class won't click the mouse
try this instead. I had the same problem:

Java Syntax (Toggle Plain Text)
  1. try
  2. {
  3. robot = new Robot();
  4. robot.mouseMove(0,900);
  5. robot.mousePress(InputEvent.BUTTON1_MASK);
  6. robot.mouseRelease(InputEvent.BUTTON1_MASK);
  7. }catch(Exception e){}
Reputation Points: 11
Solved Threads: 7
Posting Whiz in Training
Clawsy is offline Offline
225 posts
since Feb 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Robot click exception: Invalid combination of button flags
Next Thread in Java Forum Timeline: jradiobuttons getting randomly selected on their own





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC