Use custom Java custom cursor

I know that users can define their own system cursors on Windows and OSX. However, I did not find a way to use these cursors in the Java class.

For example, let's say I have a JFrame and a custom component, for example:

Link in jframe

This cursor was set using setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)) . But I want to use the user-defined link cursor to make the application more integrated with the OS. Is there a way not to use a Java reference pointer? Do I need to explicitly request a file? Or do I need to use JNA or something else?

--- --- EDIT

I think I need to make the question more understandable.

Say that the user has set their system link pointer (the cursor that appears when you hover over the link, for example, in a web browser) on the banana image. How to switch to a banana cursor when hovering over a custom component?

+5
source share
1 answer

Have you jLabel1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); this method should get the system cursor as you like.

0
source

Source: https://habr.com/ru/post/1211743/


All Articles