Is there a way to set the cursor's location in JavaFX while the window is in focus? I've searched the possibility of the Scene's cursor object, but that leads to a dead end.

  • \$\begingroup\$ Heads up: JavaFX is completely useless for anything that isn't basic or requires more than 10 FPS (made up figure). OpenGL is recommended. \$\endgroup\$
    – Lucien
    Nov 15, 2015 at 20:09
  • \$\begingroup\$ What really? For my PC it does really well... \$\endgroup\$ Nov 15, 2015 at 23:27
  • \$\begingroup\$ It wasn't designed for games. Anything that requires any decent amount of rendering won't work out very well. You should check out LibGDX. \$\endgroup\$
    – Lucien
    Nov 16, 2015 at 6:23
  • \$\begingroup\$ I was looking at that however I never found any good tutorials... :( \$\endgroup\$ Nov 16, 2015 at 12:11

1 Answer 1


Have you tried the function mouseMove(int x, int y) like this:

new Robot().mouseMove(150, 200); ?

Source: Robot (Java 2 Platform SE 5.0)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .