Article View: borland.public.jbuilder.java.swing
Article #10170Re: Problem with URL
From: Olaf Raether
Date: Thu, 04 Nov 1999 00:00
Date: Thu, 04 Nov 1999 00:00
42 lines
1389 bytes
1389 bytes
Michel,
try something like this:
URL url = new
URL("file:///D:/JBuilder3/samples/jdk/demo/jfc/SwingSet/images/cow.gif");
ImageIcon ii = new ImageIcon(url, "ddd");
the second Parameter is only a description field like "my icon".
Olaf
On Wed, 3 Nov 1999 09:56:03 -0400, "Michel PοΏ½rez"
<mperez@eurobanco.com> wrote:
> hi,
>
> I'm having a problem fetching an image from a file, using his URL for
> accessing it. My icon files are kept in c:\aplicacion\images, so I tried
>the
> following piece of code:
>
> try {
> URL myUrl = new URL(file:///c:/aplicacion/images);
> }
> catch (MalformedURLException e) {
> ...
> }
> and then
> ImagSol = new ImageIcon(url,"sol.gif");
>
> that's when I'm having the exception:
> uncaught error fetching image: java.lang.NullPointerException
> at sun.awt.image.URLImageSource.getConnection(URLImageSource.java:106)
>
> Can anyone help me?
>
> thanks a lot,
>
> Mairobi
>
>
Technical Details
Message-ID:
<3821335e.3033311@forums.inprise.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7vpenn$c374@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 111d45,9007e0e25ba0667d X-Google-Attributes: gid111d45,public From: o.raether@windsoft.de (Olaf Raether) Subject: Re: Problem with URL Date: 1999/11/04 Message-ID: <3821335e.3033311@forums.inprise.com> X-Deja-AN: 544285828 References: <7vpenn$c374@forums.borland.com> Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.swing