Article View: borland.public.jbuilder.java.swing
Article #9488Re: HELP: simple loading gif question
From: John P. McGrath
Date: Tue, 28 Mar 2000 00:00
Date: Tue, 28 Mar 2000 00:00
32 lines
1800 bytes
1800 bytes
On Mon, 27 Mar 2000 14:26:52 -0500, Stephen Legge wrote:
> > Try:
> > ImageIcon myIcon = new ImageIcon(
> > getClass().getResource("mypicture.gif") );
>
> This doesn't work -- getClass().getResource("mypicture.gif") always
> returns null. I'm using JBuilder 3.5 (with 1.2.2), does this only
> work in 1.1.x?
No - this should work in JDK 1.1, 1.2, and 1.3. Are you sure the file
exists? Spelled correctly? It may be that the problem is in something
that you are not telling us about. The best way to deal with problems
like this is to create a minimal example that demonstrates the problem,
and post the example. Then others can try running it, and perhaps detect
the problem.
> > Place the image file in the same folder as the source file for
> > the Java class that contains the above code, and add it to your
> > project. JBuilder will automatically copy it to the folder that
> > contains the .class file, which is where it needs to be.
>
> It doesn't appear to be working. Do you have any other suggestions?
Are you saying that the file does not get copied to the output path? If
so, that would explain the problem above.
--
John P. McGrath
<JPMcGrath@fast.net>
<jpm@nscs.fast.net>
Technical Details
Message-ID:
<MPG.134a0f31d121218a98982f@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<8bdtn7$hr12@bornews.borland.com> <MPG.13461abddce43f35989825@forums.borland.com> <8bobu5$n2p4@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: John P. McGrath <JPMcGrath@fast.net> Subject: Re: HELP: simple loading gif question Date: 2000/03/28 Message-ID: <MPG.134a0f31d121218a98982f@forums.borland.com> X-Deja-AN: 603277981 References: <8bdtn7$hr12@bornews.borland.com> <MPG.13461abddce43f35989825@forums.borland.com> <8bobu5$n2p4@bornews.borland.com> Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.swing