2 回答

ITMISS
TA贡献1871条经验 获得超8个赞
java.awt.Robot可能会有所帮助。
这是Java Tips的一个简单示例代码片段:
try {
Robot robot = new Robot();
// Simulate a mouse click
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
// Simulate a key press
robot.keyPress(KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_A);
} catch (AWTException e) {
e.printStackTrace();
}

桃花长相依
TA贡献1860条经验 获得超8个赞
robot.keyPress(KeyEvent.VK_A);robot.keyPress(KeyEvent.VK_B);robot.keyRelease(KeyEvent.VK_A);robot.keyRelease(KeyEvent.VK_B);
添加回答
举报
0/150
提交
取消