有没有办法将.cur文件格式的Cursor用作Java应用程序的游标? [英] Is there a Way to take .cur file formatted Cursor as the Cursor of a Java Application?

查看:95
本文介绍了有没有办法将.cur文件格式的Cursor用作Java应用程序的游标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我们可以使用ImageIcon类和Cursor类来创建游标并将其分配给Componenet。

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");

我只是Google搜索了一下是否有一种方法可以将.cur(Windows光标格式)作为Java应用程序中的游标。但是我找不到方法...

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...

但是,由于.cur是一种著名的文件格式,因此我仍然认为应该有一种方法。
实际上,有没有办法将.cur文件格式的Cursor用作Java应用程序的Cursor?
然后如何?

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 ?

推荐答案

.cur是Windows光标文件,在Windows平台以外的环境中将不起作用(即Win32 API或.NET Framework API)。 Java运行时环境要求自定义光标为PNG或GIF格式。仅仅因为您在Windows系统上使用Java并不意味着您可以在Swing / AWT中将这种格式用于GUI。

.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.

以下是使用正确格式的教程:代码海滩:自定义Java光标

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

这篇关于有没有办法将.cur文件格式的Cursor用作Java应用程序的游标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆