How to set Java cursor to unavailable icon?

KUSH42 :

I am writing a simple JavaFX GUI that supports file select using drag & drop. I already implemented the drag & drop functionality itself, but I want to change the cursor to the OS-specific (if present) unavailable/not permitted pointer if files of the wrong type are dragged over the input area.

Unfortunately the pre-defined cursor enums in the Cursor class do not give access to that one.

Is there an option to load the icon for the cursor from the OS through Java directly, without the need to import it into the .jar as image resource or making a JNI call to extract it from (in case of Windows) the ole32.dll?

How do other Java applications handle that? Pretty sure delivering the Windows-specific icon with the application would be a breach of copyright so I'd like to avoid that.

VGR :

The “not allowed” system cursor will be used by default, if your dragOver handler does not call DragEvent.acceptTransferModes.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=71416&siteId=1