Article View: borland.public.jbuilder.java.swing
Article #9140Re: images !!!!!!!!!!!!!!!!!!!!
From: Greg Hamer
Date: Tue, 16 May 2000 00:00
Date: Tue, 16 May 2000 00:00
37 lines
1630 bytes
1630 bytes
ImageIcon throws a null pointer exception when the supplied URL cannot be
located.
It is better to specify the gif relative to a class, you just need to make
sure that the gif file is in the right place relative to the class file. In
your case, "directory.gif" needs to
be in the same directory as the class file that contains the
aliasChooser.setIcon() property setting. If you add the gif file to the
project, and it is placed in the same directory as the java file, JBuilder
will copy it over into the similar location on the output path.
Sven Goetgeluck <sven.goetgeluck@pandora.be> wrote in message
news:3921b074@dnews...
> Hi,
> when using icons from recources in project it crashes , when reading
> directly from harddisk is works
>
> fe
> menuFileExit.setIcon(new
> ImageIcon("c:\\jBuilder3\\myprojects\\vrex4\\Stop16.gif"));
> this works
>
> aliasChooser.setIcon(new
>
ImageIcon(this.getToolkit().getImage(getClass().getResource("directory.gif")
> )));
> somethimes crashes
>
>
> what could it be??
>
>
>
>
> txs
> sven.goetgeluck@pandora.be
>
>
Technical Details
Message-ID:
<8fsbte$93v8@bornews.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3921b074@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,f6f93a95152ff73,start X-Google-Attributes: gid111d45,public From: "Greg Hamer" <ghamer@corp.netzero.net> Subject: Re: images !!!!!!!!!!!!!!!!!!!! Date: 2000/05/16 Message-ID: <8fsbte$93v8@bornews.borland.com> X-Deja-AN: 624235614 References: <3921b074@dnews> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing