How to change JFrame icon
Here is an Alternative that worked for me:
yourFrame.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource(Filepath)));
It's very similar to the accepted Answer.
Create a new ImageIcon
object like this:
ImageIcon img = new ImageIcon(pathToFileOnDisk);
Then set it to your JFrame
with setIconImage()
:
myFrame.setIconImage(img.getImage());
Also checkout setIconImages()
which takes a List
instead.
JFrame.setIconImage(Image image)
pretty standard.