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?
Asked
Active
Viewed 405 times
0
-
1This question is very vague. Can you give more details of what you exactly are trying to achieve? – Martijn Courteaux Dec 27 '11 at 13:59
-
How is your need different from the functionality provided by tool tips? – Hovercraft Full Of Eels Dec 27 '11 at 14:00
-
I don't quite get it, don't you move your cursor _over_ something? Could you provide an image of what you want to achieve? – Thomas Dec 27 '11 at 14:00
-
I think OP needs transparent cursor. Is it? – Harry Joy Dec 27 '11 at 14:01
-
@AndriyKushka, I'd be wary of introducing such an atypical behavior to such a commonplace component. – mre Dec 27 '11 at 14:50
-
guys, in two words I need to create semi-transparent cursor – Andriy Kushka Dec 27 '11 at 15:28
-
@Andriy Kushka in three words I need clean_up my car – mKorbel Dec 27 '11 at 19:22
2 Answers
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;
}