Results 1 to 6 of 6
Thread: Default Swing Images
- 10-10-2008, 02:03 AM #1
Default Swing Images
I have downloaded the default images in jlfgr-1_0.jar, and put this jar file at:
c:\Java
From the control panel, I have set CLASSPATH to be:
.;C:\Java\jlfgr-1_0.jar
I am unable to get the images to appear in the simple app that I copied (I can't put it here because I am a newbie). They have good examples, but no real help.
What am I missing? :confused:Using Windows Vista, Eclipse, NetBeans, jdk1.6.0_07
- 10-10-2008, 02:48 AM #2
Many possiblities for problems. So hard to know where to start.
What is in the .jar file that you mentioned?
Where is the program code? What command do you issue to start the program? Do you get any error messages?
What is in the jar file's manifest file?
Did the program ever work?
Are the paths to the images in the jar file correct?
How does the program access the images?
I'll will let you try to answer the above and we'll go on from there.
- 10-10-2008, 04:50 AM #3
The .jar file ca,e from Sun and contains a folder called "toolbarButtonGraphics".
In that folder are multiple sub-folders, including one called "general". In general, are a bunch of 16x16 gif and corresponding 24x24 gifs. They have names like Copy16.gif, Copy24.gif, Cut16.gif, Cut24.gif, etc.
I use Eclipse and my code is in the workspace. This specific code is in:
c:\Users\BuBBa\workspace\SwingRolloverComponent\sr c\RolloverComponent.java.
I run the code from Eclipse using the run button.
I get no errors, but no images. I have tried this with multiple examples, and they all work except I do not get the images in the .jar file.
The code I copied is at:
www roseindia net/ java/ example/ java/ swing/ RolloverComponent.shtml
(pardon the spaces in the link - I can't post links on this site yet - I'm not trying to cheap, but rather give the EXACT code I copied).
That site has some nice, simple examples and everything I have tried has worked very well except getting the images from the .jar file.
I guess the first question is: Java should be able to extract these images, right?
Thanks.Using Windows Vista, Eclipse, NetBeans, jdk1.6.0_07
- 10-10-2008, 07:49 AM #4
I've seen the roseindia site. They have poor examples with extremely poor coding style. I advise you to stay away from there.
If you're looking for a tutorial, why not use Sun's own one?
The Java™ Tutorials
AFAIK CLASSPATH is for loading classes, not resources. I suggest you extract the images you need to a folder in your project hierarchy and load them using getResource.
db
- 10-10-2008, 12:55 PM #5
Thanks for the advice. I will check out your suggested link.
Using Windows Vista, Eclipse, NetBeans, jdk1.6.0_07
- 10-10-2008, 03:00 PM #6
Yes, java can read images from jar files.
How does the program access the images?
What is the source code used to read the images?
What path is used?
What are the paths to the images in the jar file? Use winzip to look inside the jar file.
The paths must match.
To get resources from a jar file you must use a getResource method. The code you are using probably tries to read from a local disk. There are code examples on the forum on how to use getResource. Use Search.Last edited by Norm; 10-10-2008 at 03:03 PM.
Similar Threads
-
want default value in ComboBox from DB!!
By Java.child in forum AWT / SwingReplies: 2Last Post: 10-04-2008, 12:25 AM -
want default value in ComboBox !!
By Java.child in forum SWT / JFaceReplies: 0Last Post: 09-29-2008, 09:57 PM -
Printing default Swing values
By Java Tip in forum Java TipReplies: 0Last Post: 03-12-2008, 11:09 AM -
Swing - Changing component default font
By Java Tip in forum Java TipReplies: 0Last Post: 03-11-2008, 10:52 PM -
Default Button
By hiranya in forum AWT / SwingReplies: 2Last Post: 11-01-2007, 06:08 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks