JavaFX custom css cursor

I am searching on the Internet, but I cannot find how to set a custom cursor in javaFX with css , I know how to do it using the ImageCursorfollowing way:

How to create a custom cursor in javaFX?

but I use this line in cssand not working:

setStyle("-fx-cursor:url('/images/pencil.png')");

Is it possible to create a costume with css?

+4
source share
1 answer

When using a custom CSS cursor , a backup without a URL (one or more other values) should be at the end of the backup list, i.e. auto, so your code should look like this:

//---------------------------------------------- ↓
setStyle("-fx-cursor:url('/images/pencil.png'),auto");
+2

All Articles