You need to create a cursor with a watermark

I need to create a cursor with a transparent (watermark) image, i.e. if I move the cursor under, for example, some text, I need to see this text, can someone help me with this?

+1
source share
2 answers

To create a custom cursor, use the java.awt.Toolkit.createCustomCursor method.

+4
source
 public Cursor pointer() throws Exception { int[] pixels = new int[16 * 16]; Image image = Toolkit.getDefaultToolkit().createImage( new MemoryImageSource(16, 16, pixels, 0, 16)); Cursor transparentCursor = Toolkit.getDefaultToolkit().createCustomCursor( image, new Point(0, 0), "invisibleCursor"); return transparentCursor; } 
+2
source

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


All Articles