问题
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.
Does anyone know what cursor names are available, or how to enumerate them on a particular system?
回答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.
来源:https://stackoverflow.com/questions/24233542/what-cursors-are-available-through-cursor-getsystemcustomcursor