I want to display another icon instead of the usual java load icon. I have put that into this folder:
I want to load it over the getResource()
method.
setIconImage(Toolkit.getDefaultToolkit().getImage(MainWindow.class.getResource("house.png")));
However, I am getting:
Uncaught error fetching image:
java.lang.NullPointerException
at sun.awt.image.URLImageSource.getConnection(Unknown Source)
at sun.awt.image.URLImageSource.getDecoder(Unknown Source)
at sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)
at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
at sun.awt.image.ImageFetcher.run(Unknown Source)
Why does getResource()
not load my picture from my folder? I appreciate your answer!