This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Icons and a Label Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Icons and a Label" Watch "Icons and a Label" New topic
Author

Icons and a Label

David Crossett
Ranch Hand

Joined: Feb 05, 2003
Posts: 102
Can anyone tell my why my icon isn't showing up? I have the .gif file copied to the main directory, the class directory, and the src directory (just to be safe). I thought that I only needed th .gif in the .class folder (the same directory the program is running from). Anyway, all I see is test with no icons.

thanks!


David Crossett
-nothing important to say, but learnin' plenty-
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
Hi I cannot see anything wrong in the code. Try with another image file.


SCJP2. Please Indent your code using UBB Code
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
to help figure out what's going on, use the full path to the image (just for testing) and see if that works. that will tell you if it's not finding the image or not. i bet you have it in a place that the vm can't find it. try putting it in the dir you are running from instead of hte place where the classes are.
you should probably put your code and the image in a .jar file - then it is easy to load the image with something like:

brian


My Java Freeware:<br />MACCC - <a href="http://maccc.pipasoft.com" target="_blank" rel="nofollow">http://maccc.pipasoft.com</a><br />Nator - <a href="http://nator.pipasoft.com" target="_blank" rel="nofollow">http://nator.pipasoft.com</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Icons and a Label
 
Similar Threads
Icons and labels?
I can't load a file with getResource
Would my code help?!
Java Software Solutions Graphics Example 3.9 noob help
How to show the label with mnemonic key in a scrollPane?