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?