Article View: borland.public.jbuilder.java.swing
Article #8507Re: icons in resouce files
From: Greg Hamer
Date: Thu, 10 Aug 2000 00:00
Date: Thu, 10 Aug 2000 00:00
45 lines
2299 bytes
2299 bytes
The JBuilder designer only uses hard coded paths for accessing image files if it cannot find a nearby class file to do the right thing with. If the image file is in the source path and a class file exists in the same directory or higher up, it will generate the class.getResource() style code. "Joi Ellis" <joi@aravox.com> wrote in message news:39916BA2.F23915FD@aravox.com... > 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:
<8mukkn$8u2@bornews.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<399132b2$1_1@dnews> <39916BA2.F23915FD@aravox.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,59ce72ffe7b40e6e X-Google-Attributes: gid111d45,public From: "Greg Hamer" <ghamer@corp.netzero.net> Subject: Re: icons in resouce files Date: 2000/08/10 Message-ID: <8mukkn$8u2@bornews.borland.com> X-Deja-AN: 656812506 References: <399132b2$1_1@dnews> <39916BA2.F23915FD@aravox.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing