Custom PNG Cursor - Edges Are Not Smooth

I wanted to create a custom cursor. Instead of the standard, I tried to install this: enter image description here but the last effect was terrible. The edges were black and jagged:

enter image description here

exactly the same as in this applet when loading.

The code is as follows:

final Image customCursor = new ImageIcon("C:\\Users\\my_name\\Desktop\\apple.png").getImage(); final Point hotspot = new Point(0, 0); final String name = "Cursor"; this.setCursor(getToolkit().createCustomCursor(customCursor, hotspot, name)); 

Is there a way to work around PNG with smooth edges? It seems unbelievable that there is still such an error in Java.

+4
source share
1 answer

Did you try to load it as a BufferedImage and then run "ImageIcon (yourBufferedImage)" ...?

0
source

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


All Articles