🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #9464

Re: HELP: simple loading gif question

#9464
From: James Cook
Date: Fri, 24 Mar 2000 00:00
44 lines
1720 bytes
Option #2 (putting the gif in the same directory as the class file) should
of worked. It will only show at runtime.

jim

Stephen Legge <stephen@cryptocard.com> wrote in message
news:8bdtn7$hr12@bornews.borland.com...
> Hi,
>
> I'm loading a gif file and placing it in a JButton like so:
>
> ImageIcon myIcon = new ImageIcon("c:/gifs/mypicture.gif");
> btnConnect.setIcon(myIcon);
>
> and it works fine.  Now I want to remove the "c:/gifs/" from the path like
> so:
>
> ImageIcon myIcon = new ImageIcon("mypicture.gif");
> btnConnect.setIcon(myIcon);
>
>
> But this isn't working.  I tried three things:
>   putting the gif file in the same folder as the .java file
>   putting the gif file in the same folder as the .class file
>   adding the gif file to the JBuilder project
> but nothing worked.
>
> Can someone tell me how to get the file to load without hard-coding the
full
> path?
>
> Also, when I package up my entire project as a deployable jar file, will
the
> gif file still be accessible?
>
> *Any* help is greatly appreciated!
>
> Stephen Legge
> Ottawa, Canada
>
>
> ---
>
>
Technical Details
Message-ID: <38dbb10e.0@news.dot.state.oh.us>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8bdtn7$hr12@bornews.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,6000043aed93d9a0
X-Google-Attributes: gid111d45,public
From: "James Cook" <jimcook.spaminator@remove.for.spam.iname.com>
Subject: Re: HELP: simple loading gif question
Date: 2000/03/24
Message-ID: <38dbb10e.0@news.dot.state.oh.us>
X-Deja-AN: 601852829
References: <8bdtn7$hr12@bornews.borland.com>
X-Trace: 24 Mar 2000 13:16:46 -0500, dotfw001-dmz.dot.state.oh.us
X-MSMail-Priority: Normal
X-Priority: 3
Newsgroups: borland.public.jbuilder.java.swing
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300