Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Icons not showing when building .JAR file?

569130Apr 11 2009 — edited Apr 11 2009
Hello....

I'm currently using Netbean 6.1 and I just want to add some GIF files to my program when it builds. I'm using the files as icons for some of the GUI buttons and labels. But when I select clean and build main project or build main project and execute the JAR file outside the IDE, the icons are missing.

I put the image files into my project folder and basically just add this kinda code in.
Icon smile = new ImageIcon("smile.gif");
label2 = new JLabel("Label with text and smiley icon", smile,
SwingConstants.LEFT);
label2.setToolTipText("This is label2");
container.add(label2); 

Icon smile = new ImageIcon("smile.gif"); 
label2 = new JLabel("Label with text and smiley icon", smile, SwingConstants.LEFT); 
label2.setToolTipText("This is label2"); container.add(label2);
So..I'm wondering if anyone can help me with this....

Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 9 2009
Added on Apr 11 2009
3 comments
616 views