Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用 Java 移动鼠标光标(Windows)?我有一对不断更新的价值观。我想用它们来控制光标。
Robot.mouseMove(x,y)
如 OscarRyz的https://stackoverflow.com/a/2941373/1150918中所述。
您将需要使用 Robot 类。
Robot r = null; try { r = new Robot(); } catch (AWTException e) { // TODO Auto-generated catch block e.printStackTrace(); } r.mouseMove(x, y);//x is the horizontal position on the screen, y is the vertical