What cursors are available through Cursor.getSystemCustomCursor?

拟墨画扇 提交于 2019-12-10 16:56:35

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!