I am using Java to generate a mouse press using the Robot class:
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
However, I want the Robot to press the button for a certain period of time. How can I achieve this?
Just sleep a bit between the two actions (specified in milliseconds):
Thread.sleep(long millis);Robot.delay(long millis);