I would like to change the cursor icon to my customized 32x32 image when a Java application is executing. I looked and searched, those I found are just setting cursor on a JComponent. But I want the cursor changed to my specified icon wherever it goes moving, browsing, and click, as long as the Java application is still running, or you can say program runtime.
Thanks alot.
Standard cursor image:
setCursor(Cursor.getDefaultCursor());
User defined Image:
Toolkit toolkit = Toolkit.getDefaultToolkit();
Image image = toolkit.getImage("icons/handwriting.gif");
Cursor c = toolkit.createCustomCursor(image , new Point(mainPane.getX(),
mainPane.getY()), "img");
mainPane.setCursor (c);
You can download a zip containing sample source: HERE