Search code examples
javacursor

Is there a Way to take .cur file formatted Cursor as the Cursor of a Java Application?


I know We can use ImageIcon class and Cursor Class to Create a Cursor and Assign it to a Componenet. As a Example

Image image1 = toolkit.getImage("Released.gif");
Cursor c1 = toolkit.createCustomCursor(image1, new Point(5,5), "img");

I Just Googled to find whether there is a way to take .cur(Windows Cursor Format) as a Cursor in Java application. But I Couldn't find a way...

But still feels there should be a way to do that as .cur is a famous file format. Actually, Is there a way to take .cur file formatted Cursor as the Cursor of a Java Application ? Then How ?


Solution

  • .cur is a Windows Cursor File and will not work in environments outside of the Windows Platform (ie Win32 API or .NET Framework APIs). The Java Runtime Environment requires that custom cursors are in PNG or GIF format. Just because you are using Java on a Windows system does not mean that you can use that format for a GUI in Swing/AWT.

    Here's a tutorial for when you have the correct format: CodeBeach: Custom Java Cursors