0

I need to create cursor with transparent(watermark) image, ie if I moving cursor under for example some text I need to see that text, can somebody help me with that?

2 Answers2

4

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

mre
  • 43,520
  • 33
  • 120
  • 170
2
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;
}
mKorbel
  • 109,525
  • 20
  • 134
  • 319
Gokul
  • 455
  • 6
  • 17