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

你。 提交于 2019-12-24 11:37:27

问题


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 ?


回答1:


.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



来源:https://stackoverflow.com/questions/28176840/is-there-a-way-to-take-cur-file-formatted-cursor-as-the-cursor-of-a-java-applic

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!