Robot robot = new Robot();
//设置响应延时
robot.setAutoDelay(100);
//鼠标移动到的位置的坐标
robot.mouseMove(100, 200);
//鼠标双击事件(按下+释放)
//InputEvent.BUTTON1_MASK InputEvent.BUTTON2_MASK InputEvent.BUTTON3_MASK 分别代表左中右键
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
robot.delay(100);//停顿100ms
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
//向下滚动5个刻度滑轮:
robot.mouseWheel(5);
转载于:https://www.cnblogs.com/xiaoduilantian/p/9206081.html