在Ubuntu 12.04中未显示JFrame图标 [英] JFrame icon not displaying in Ubuntu 12.04

查看:52
本文介绍了在Ubuntu 12.04中未显示JFrame图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了使用一些图像图标的Swing应用程序.应用程序jar文件在Windows中可以按预期工作,但同一jar文件在Ubuntu 12.04操作系统上未显示框架的图像图标.

I have developed a Swing application using some image icons. The application jar file is working as expected in Windows but same jar file is not displaying image icon of frame on Ubuntu 12.04 operating system.

我的示例代码:

 ImageIcon ImageIcon = new ImageIcon(getClass().getResource("/images/logo.png"));
 Image Image = ImageIcon.getImage();
 frame.setIconImage(Image);

注意:带有按钮的图像按预期显示,问题仅在于加载帧图像.

Note: images with buttons are displaying as expected, the problem is only with the loading of the frame image.

有人可以建议我如何解决这个问题吗?

Can anybody suggest me how to resolve this one?

推荐答案

设置装饰的JFrame外观,

Set your JFrame look and feel to decorated,

JFrame.setDefaultLookAndFeelDecorated(true);

这篇关于在Ubuntu 12.04中未显示JFrame图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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