Robot class won't click the mouse

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Aug 2004
Posts: 350
Reputation: Ghost is an unknown quantity at this point 
Solved Threads: 2
Ghost's Avatar
Ghost Ghost is offline Offline
Posting Whiz

Robot class won't click the mouse

 
0
  #1
Aug 29th, 2008
I have this code:
  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?
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 413
Reputation: sciwizeh is on a distinguished road 
Solved Threads: 22
sciwizeh's Avatar
sciwizeh sciwizeh is offline Offline
Posting Pro in Training

Re: Robot class won't click the mouse

 
0
  #2
Aug 29th, 2008
it appears that Robot only works on swing buttons, and applications
My site, random PM's from people I haven't hear from before will be DELETED
"If people are good only because they fear punishment, and hope for reward, then we are a sorry lot indeed.",
"If we knew what it was we were doing, it would not be called research, would it? "
-Albert Einstein
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 1
Reputation: Geazie is an unknown quantity at this point 
Solved Threads: 0
Geazie Geazie is offline Offline
Newbie Poster

Re: Robot class won't click the mouse

 
0
  #3
May 3rd, 2009
Originally Posted by sciwizeh View Post
it appears that Robot only works on swing buttons, and applications
This is not true. Although this is what it was primarily intended.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 107
Reputation: Clawsy is an unknown quantity at this point 
Solved Threads: 5
Clawsy Clawsy is offline Offline
Junior Poster
 
0
  #4
21 Days Ago
try this instead. I had the same problem:

  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){}
Reply With Quote Quick reply to this message  
Reply

Message:




Views: 1246 | Replies: 3
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC