Hi,
calls the repaint for each mouseMove and this seems inefficient.
Indeed...
But I do not find a possibility of using images here, since the needed cursor is big and the image size would overlap the panel completely hiding the drawings.
You can paint the image with transparency.
Draw into BufferedImage, here couple of links for example
Creating a Buffered Image
Drawing on a Buffered Image
Now you only set cursor property on mouseOver events on whatever component
I forgot to ask, is it your requirement that the crosshair's centre point must be in cursor's location when moving the mouse?
If so then you could draw only a small part of the area on mouseMoved event determining if the mouse moved horizontally then you draw more vertically or mouse moved vertically you draw more horizontally through repaint(Rectangle) method call... dont know maybe someone has a better idea...
And in which component you are drawing this crosshair, in the actual JPanel or perhaps in glassPanel?