Drawing Custom Cursor in Java Swing

Use ArtCursors software Trail version to draw an image and put that in say multimedia\test.gif in your Eclipse project folder.
Use the code:
----------------------------------------------------------------
Toolkit CursorTk = Toolkit.getDefaultToolkit();
CursorImage = CursorTk.getImage(".\\multimedia\\test.gif");
int Width = CursorImage.getWidth(null);
if (Width >= 0)
{
System.out.println("Image Loaded");
} else {
System.out.println("Image Loading Failed");
}

Cursor TunnelCursor = CursorTk.createCustomCursor(CursorImage,new Point(0,0),"cursor");

Object.setCursor(TunnelCursor);
------------------------------------------------
Object is a your Farme/Panel object.

I will post a complete code that does all these in a while....

~rAGU

Comments