ImageIcon fehler ?

knopper

Mitglied
Hallo,

My code source:

private ImageIcon mobiOffIcon = new ImageIcon(Tray.class
.getResource("icons/mobi_off.png"));
Zeile : 58
private ImageIcon mobiOnIcon = new ImageIcon(Tray.class
.getResource("icons/mobi_on.png"));


Ich bekomme diese Fehlermeldung:

Exception in thread "Thread-7" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(Unknown Source)
at mipmanager.Tray.<init>(Tray.java:57)

das Verzeichniss der beiden Icon datei sind richtig angegeben.

Waoran liegt das ?

Gruss
 
Hallo Knopper,
versuch mal folgendes:
Code:
 new ImageIcon(getClass().getResource("/icons/mobi_on.png"));

Wichtig ist der Slash vor dem Ordner icons.
 
Zurück