How to create a custom cursor in javaFX?

I am trying to create a custom cursor in javaFX. Here is my code:

Image image = new Image("mycursor.png");

Pane pane= new Pane();
pane.setCursor(new ImageCursor(image,
                                image.getWidth() / 2,
                                image.getHeight() /2));

Does creating cursors work for Windows 8.1?

0
source share
1 answer

Check out the ImageCursor.getBestSize () and ImageCursor.getMaximumColors () methods and see what they return, and then try to create your own cursor image that matches the maximum size and maximum colors. Most likely, it will be a 32x32 cursor for Windows 8.1.

Here is a quote from ImageCursor.getBestSize()javadoc:

, . (0,0) , .

: , size ( ), . .

. , , Windows Vista 32x32 , Mac Linux 64x64. 32x32-, 64x64 , .

, ​​ , , , .

+4

All Articles