I looked at other answers and tried:
ImageIcon img = new ImageIcon(url);
setIconImage(img.getImage());
and:
URL imgURL = getClass().getClassLoader().getResource(url);
if (imgURL != null) {
System.out.println("Found icon image: "+imgURL);
Image image=Toolkit.getDefaultToolkit().getImage(imgURL);
setIconImage(image);
} else {
System.err.println("Could not find icon image");
}
Within the JFrame
class and I put the image file in the resource folder, and also the same folder as my .java
files and the root folder of my project and even included the "/" symbol at the beginning of the URL string but nothing is working. I was wondering if anyone tried it lately and got it working?