0

Hello,

I am writing a chat server application in eclipse ide how i wish to change the jar default image icon but all attempt end either in error or the line of code running with change the icon. here is where i put the code.

setIconImage(new ImageIcon(ClassLoader.getSystemResource("chatbutton.jpg")).getImage());

and here is the error i got.

Exception in thread "main" java.lang.NullPointerException
    at javax.swing.ImageIcon.<init>(Unknown Source)
    at ChatMain.main(ChatMain.java:29)
3
Contributors
3
Replies
10
Views
4 Years
Discussion Span
Last Post by softswing
0

Now I create an object like this Icon b = new ImageIcon(getClass().getResource("chaticon.jpg")); how do I call it so it could change my java default icon?

-1

Icon b = new ImageIcon(getClass().getResource("/chaticon.jpg"));
use "/" at starting of image location

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.