'What cursors are available through Cursor.getSystemCustomCursor?

java.awt.Cursor has a method getSystemCustomCursor(String name).

The documentation there gives only one example of a name: "Invalid.16x16". That doesn't seem to work, but "Invalid.32x32" does. Through googling, I've found one other example of a useful working name: "MoveDrop.32x32".

This method seems like it could be useful. For example, there is no predefined "working in background" (mixed arrow/hourglass) cursor but perhaps it's available through this method.

What cursor names are available, or how can I enumerate them on a particular system?



Solution 1:[1]

See cursors.properties files that defines custom system cursors. It resides in <path_to_jre>\lib\images\cursors folder. For example there is a definition of MoveDrop.32x32:

Cursor.MoveDrop.32x32.File=win32_MoveDrop32x32.gif
Cursor.MoveDrop.32x32.HotSpot=0,0
Cursor.MoveDrop.32x32.Name=MoveDrop32x32

See Custom Cursor Shapes article for a custom cursor definition example.

Not sure there is a way to query this file for predefined system cursors. So this method may not be very useful in certain scenarios.

See Toolkit.createCustomCursor() for a simpler way to create a custom cursor. Or you can use Cursor.getPredefinedCursor to get predefined cursors.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1