How to change the Window Icon of your Java Application


Picture:Clock Published on April 27th, 2006 in Java

own iconEver wondered how to get that annoying Java cup icon out of your applications and exchange it with your own? Well, it’s easier than you might think, leaving me wondering why there are so many Java apps still carying aroung that ugly standard icon.
Here’s the code:

frame.setIconImage(new ImageIcon(”feed-icon-16×16.png”).getImage());

Pretty easy, huh?

I successfully tested it with the PNG, JPEG and GIF formats. But I suggest you use the PNG format if possible, because of its sophisticated, built-in transparency features. The dimensions your icon should have are: 16 x 16 pixels. If it isn’t, it will be scaled to that size resulting in some ugly artifacts.

As you can see, I tested it with the official RSS feed icon, which can be found at: http://www.feedicons.com

Share This

Trackback URL for this post:
http://www.yatblog.com/2006/04/27/how-to-change-the-window-icon-of-your-java-application/trackback/


2 comments

    Alex September 10th, 2007

    BTW: Its called a Control Box. I wish i had a better reference than this: http://www.ptti.com/html/help/Window_C.htm

    shayne February 19th, 2008

    hey! nice! thanks!

Shout it out!