Robot.mouseMove does not work at all in Mac OS X
问题 I created java file in IntelliJ IDE, with that code import java.awt.AWTException; import java.awt.MouseInfo; import java.awt.Robot; public class JavaRobotExample { public static void main(String[] args) { int x = 12, y = 300; try { Robot robot = new Robot(); robot.mouseMove(x, y); int xAct = (int) MouseInfo.getPointerInfo().getLocation().getX(), yAct = (int) MouseInfo.getPointerInfo().getLocation().getY(); String sPred = String.format("Predicted mouse location : %, d, %, d", x, y), sAct =