28 June 2006

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

No comments:

Post a Comment

Please leave a note about what you think about this write up. Thanks.

ಯಕ್ಷಮಿತ್ರದಿಂದ ಹೊಸ್ತೋಟ ಭಾಗವತರ ಯಕ್ಷಗಾನ ಲಕ್ಷಣ ಗ್ರಂಥ ಪ್ರಕಟಣೆ

                      ಪುಸ್ತಕಕ್ಕಾಗಿ ಸಂಪರ್ಕಿಸಿ ಅಮೇರಿಕಾಸ್: +16473283934                        ಭಾರತ — ರವೀಂದ್ರ ಮುದ್ರಣಾಲಯ ಸಾಗರ, ಮೋ: +9194495872...