🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Problem with setIcon in JButton

#9538
From: Carlos
Date: Fri, 10 Mar 2000 00:00
23 lines
1337 bytes
At runtime (java.exe) , executing the line:

  jButton1.setIcon(new ImageIcon(srvReports.MarcoVis.class.getResource("exit.gif")));

this exception occurs:  

java.lang.NullPointerException
        at javax.swing.ImageIcon.<init>(ImageIcon.java:106)
        at srvReports.Frame1.jbInit(Frame1.java:143)
        at srvReports.Frame1.<init>(Frame1.java:40)
        at srvReports.SrvRpt.<init>(SrvRpt.java:21)
        at srvReports.Aplicacion.<init>(Aplicacion.java:8)
        at srvReports.Aplicacion.main(Aplicacion.java:16)

This image ("exit.gif") is already added to the project (srvReports), and it is distributed in the jar file.
"Exit.gif" is located in the project folder too.

I have another application that sets the image icon in the same way, but it doesn't fail.

What can I do to solve it?

    Carlos Bravo.
Technical Details
Message-ID: <38c8c45e@dnews>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,6e45252150779fb9,start
X-Google-Attributes: gid111d45,public
From: "Carlos" <carlos@proin.es>
Subject: Problem with setIcon in JButton
Date: 2000/03/10
Message-ID: <38c8c45e@dnews>
X-Deja-AN: 595620385
Sender: "Carlos" <carlos@proin.es>
X-Trace: 10 Mar 2000 01:46:06 -0800, 207.105.83.65
Reply-To: "Carlos" <carlos@proin.es>
Newsgroups: borland.public.jbuilder.java.swing
X-User-Info: 62.82.211.79 62.82.211.79