Hi to all.
I'm having problems changing the look of the cursor of my app. Sometimes, when the user let the mouse pointer on certain areas of the principal panel, the cursor look must change for a custom look that I have created. The problem is that when I change the aspect of the system cursor, for my custom cursor, it start to blink sometimes, and it stays blinking when I move it on areas where the cursor have to have this custom look. I'm using a code like this.
All this is into a class that extends from
JPane.
public void paintComponent(Graphics g) {
Toolkit toolkit = Toolkit.getDefaultToolkit();
Image image = toolkit.getImage("CrearTransiciones.gif");
Point hotSpot = new Point(15, 15);
Cursor cursor = toolkit.createCustomCursor(image, hotSpot, "CrearTransiciones");
if (cursorIsOver().equals(ZoneOver.Zone1)) {
setCursor(cursor);
} else {
if (cursorIsOver().equals(ZoneOver.Zone2)) {
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
} else {
if (cursorIsOver().equals(ZoneOver.Zone3)) {
setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
}
}
}
}
I have also proved to set the hotSpot into the (0, 0) point, but I'm still having the same problem.
Someone knows what I have to do to avoid the annoying blinking?
Thanks for read.