开发者

JDialog - how to change icon

I want to change icon of the JDialog (to r开发者_StackOverflow中文版eplace standard java cup) I am able to do that this way:

ImageIcon img = new ImageIcon(OuterClass.class.getResource("fileThatWorks.jpg"));
myJDialog.setIconImage(img.getImage());

Howerver when I replaced fileThatWorks.jpg with image.ico code stopped working. I've tried to convert my image.ico to image.jpg but it didn't nelped.

What's wrong with my approach? Why it works for some *jpg files but doesn't work for *ico files?


The ImageIcon API states that the supported types are JPEG & GIF. Not too sure of a workaround for that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜