Is there a Way to take .cur file formatted Cursor

2019-08-06 01:33发布

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 ?

标签: java cursor
1条回答
Summer. ? 凉城
2楼-- · 2019-08-06 01:46

.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

查看更多
登录 后发表回答