Article View: borland.public.jbuilder.java.swing
Article #9084Re: path and filename structures
From: Alan Shiers
Date: Tue, 23 May 2000 00:00
Date: Tue, 23 May 2000 00:00
44 lines
1858 bytes
1858 bytes
That worked! Thanks.
Alan
John P. McGrath wrote:
> Try this:
>
> URL url = getClass().getResource( "images/explode.gif" ) );
> Icon icon = new ImageIcon( url );
>
> --
> John P. McGrath
> <JPMcGrath@fast.net>
> <jpm@nscs.fast.net>
>
> On Mon, 22 May 2000 00:45:20 -0300, Alan Shiers wrote:
>
> > Hi there:
> > I'm trying to understand how to designate the path to a particular
> > file when making use of the ImageIcon(String filename) class. In the
> > help files it explains that the filename arguement should be something
> > like: "images/explode.gif"
> >
> > My directory stucture is like this:
> >
> > network
> > |__ jbsc
> > |__images
> >
> > My class files are in jbsc. I place a copy of explode.gif in all three
> > directories.
> > Then I tried ImageIcon("images/explode.gif"). I expected it to find the
> > file in the images directory but it didn't. So I tried just
> > ImageIcon("explode.gif") thinking it will at least find the file in jbsc
> > (the same directory as the class files). Nope, it didn't. So I tried
> > ImageIcon("network/explode.gif"). This time it found it!
> >
> > The thing is, I want it to load from the images directory. So how do I
> > tell it that?
> >
> > Alan
> >
> >
Technical Details
Message-ID:
<392A8CB0.5DFB7580@istar.ca>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3928AD50.FC6E635@istar.ca> <MPG.1393d7aa1c61f59f98993f@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,927b2d377af0df42 X-Google-Attributes: gid111d45,public From: Alan Shiers <jshiers@istar.ca> Subject: Re: path and filename structures Date: 2000/05/23 Message-ID: <392A8CB0.5DFB7580@istar.ca> X-Deja-AN: 626283606 Content-Transfer-Encoding: 7bit References: <3928AD50.FC6E635@istar.ca> <MPG.1393d7aa1c61f59f98993f@forums.borland.com> Organization: Another Netscape Collabra Server User Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing