0

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

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Clawsy
0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.