R
Ryan
I know, I know... if the file's location is on the classpath, it
should work. Well, it doesn't. No matter what I try.
I have a simple app with a toolbar which I'm putting icons on. I have
a very simple directory structure....
- bin - holds a run scripts
- lib - contains all needed jar files
- images - contains gifs, jpgs etc etc
- audio - contains audio files
My code create a JButton with an Action and adds it to a JToolbar.
That Action....
putValue(SMALL_ICON, createIcon(smallIcon));
where the icon is created by.....
URL imageURL = getClass().getResource("test.gif");
if (imageURL == null)
{
System.out.println("Resource not found");
return null;
}
return new ImageIcon(imageURL);
What is the deal? I've substituted "test.gif" with "../images/
test.gif" and every other possibility. I've even copied the gif files
into the jar file (which clearly is on the classpath since the app is
up and running) and it still can't find the resource.
Any thoughts would be great.
should work. Well, it doesn't. No matter what I try.
I have a simple app with a toolbar which I'm putting icons on. I have
a very simple directory structure....
- bin - holds a run scripts
- lib - contains all needed jar files
- images - contains gifs, jpgs etc etc
- audio - contains audio files
My code create a JButton with an Action and adds it to a JToolbar.
That Action....
putValue(SMALL_ICON, createIcon(smallIcon));
where the icon is created by.....
URL imageURL = getClass().getResource("test.gif");
if (imageURL == null)
{
System.out.println("Resource not found");
return null;
}
return new ImageIcon(imageURL);
What is the deal? I've substituted "test.gif" with "../images/
test.gif" and every other possibility. I've even copied the gif files
into the jar file (which clearly is on the classpath since the app is
up and running) and it still can't find the resource.
Any thoughts would be great.