开发者

JDialog - how to change icon

开发者 https://www.devze.com 2023-03-11 04:36 出处:网络
I want to change icon of the JDialog (to r开发者_StackOverflow中文版eplace standard java cup) I am able to do that this way:

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

精彩评论

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