我想制作一个应用来测量光标与组件中心的距离,然后将光标移回中心(就像大多数 PC 视频游戏一样)。有人有什么建议吗?
最佳答案
机器人类可以为您解决问题。下面是移动鼠标光标的示例代码:
try {
// These coordinates are screen coordinates
int xCoord = 500;
int yCoord = 500;
// Move the cursor
Robot robot = new Robot();
robot.mouseMove(xCoord, yCoord);
} catch (AWTException e) {
}
关于java - 在 Java 中移动光标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4231458/