954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Robot click exception: Invalid combination of button flags

Hi,

I want to "click" with the mouse using a Robot object like this:

Robot bot = new Robot();
        bot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
        bot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);

This results in:Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Invalid combination of button flags

I even delayed the process before it starts clicking to have time to release the mouse but the same exception appears

Clawsy
Posting Whiz in Training
225 posts since Feb 2008
Reputation Points: 11
Solved Threads: 7
 

I finally found it myself... don't know why but it works if I use "BUTTON1_MASK" instead of "BUTTON1_DOWN_MASK".

Clawsy
Posting Whiz in Training
225 posts since Feb 2008
Reputation Points: 11
Solved Threads: 7
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: