Anand Anand - 8 months ago 39
Java Question

How to change JFrame icon

I have a

that displays a Java icon on the title bar (left corner).
I want to change that icon to my custom icon. How should I do it?


Create a new ImageIcon object like this:

ImageIcon img = new ImageIcon(pathToFileOnDisk);

Then set it to your JFrame with setIconImage():


Also checkout setIconImages() which takes a List instead.