Article View: borland.public.jbuilder.java.swing
Article #8583Re: icons in resouce files
From: Joi Ellis
Date: Wed, 09 Aug 2000 00:00
Date: Wed, 09 Aug 2000 00:00
38 lines
1878 bytes
1878 bytes
Helge Smebye wrote:
>
> Hello,
>
> Are there some way to include all the icons in a jar or some other file
> type, and then access them in designtime and runtime from a applet ?
>
> -helge
Sure. Stick a gif into the same directory as a java class which
desires to load it. Add it to your JBuilder project from that
location so that JBuilder will handle copying it over to the classes
tree at compile time.
In your java file, load the icon with something like this:
selectIcon = new ImageIcon( getClass().getResource( "EastArrow.gif" ) );
This code will execute no matter what form the application is deployed
in, ie jar file, directory tree, etc.
This may not work at design time, though. Last time I looked,
Jbuilder used platform-specific hardcoded paths to access the icons.
:( So your code isn't portable.
Perhaps someone can suggest a method that's both portable and
JBuilder-friendly?
--
Joi Ellis Software Engineer
Aravox Technologies joi@aravox.com, gyles19@visi.com
No matter what we think of Linux versus FreeBSD, etc., the one thing I
really like about Linux is that it has Microsoft worried. Anything
that kicks a monopoly in the pants has got to be good for something.
- Chris Johnson
Technical Details
Message-ID:
<39916BA2.F23915FD@aravox.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<399132b2$1_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,59ce72ffe7b40e6e X-Google-Attributes: gid111d45,public From: Joi Ellis <joi@aravox.com> Subject: Re: icons in resouce files Date: 2000/08/09 Message-ID: <39916BA2.F23915FD@aravox.com> X-Deja-AN: 656360579 Content-Transfer-Encoding: 7bit References: <399132b2$1_1@dnews> To: Helge Smebye <helge.smebye@geodata.no> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Aravox Technologies Mime-Version: 1.0 Reply-To: joi@aravox.com Newsgroups: borland.public.jbuilder.java.swing