Oleg Vazhnev
Oleg Vazhnev

Reputation: 24067

JDialog - how to change icon

I want to change icon of the JDialog (to replace 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?

Upvotes: 3

Views: 10044

Answers (1)

E-Z
E-Z

Reputation: 247

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

Upvotes: 4

Related Questions