Javafx 8 how to make the mouse cursor invisible?

I am doing a 2D survey on Javafx 8 and I would like to make the cursor invisible so that I can replace it with a crosshair.

Is there any way to make the mouse cursor invisible when it is on stage?

+5
source share
1 answer

To change the cursor, you must use the scene.setCursor(String) method.

To change the image

Using the link to your current scene, go to Cursor.cursor("url") in setCursor :

 scene.setCursor(Cursor.cursor("url")); 

To remove the cursor

Using the link to your current scene, go to Cursor.NONE in setCursor :

 scene.setCursor(Cursor.NONE); 

You may also be interested in the value of Cursor.CROSSHAIR

+5
source

Source: https://habr.com/ru/post/1210145/


All Articles