I am using NetBeans trying to change the familiar Java cup of coffee icon to a png file, which I saved in the resource directory in the jar file. I found many different web pages that claim to have a solution, but none of them work yet.
Here is what I have at the moment (excluding the try-catch block):
URL url = new URL("com/xyz/resources/camera.png"); Toolkit kit = Toolkit.getDefaultToolkit(); Image img = kit.createImage(url); getFrame().setIconImage(img);
The class containing this code is in the com.xyz package, if that matters. This class also extends JFrame. This code throws a MalformedUrlException on the first line.
Does anyone have a solution that works?
java icons
Bill the Lizard Oct. 16 '08 at 18:58 2008-10-16 18:58
source share