Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

changing the coffee cup Icon in Titlebar?

843804Dec 13 2002 — edited Jan 30 2005
HI

I read all thrads about this but still dont get it working. I tried it 3 ways:

1:
ImageIcon pic = new ImageIcon("pic.gif");
this.setIconImage(pic.getimage());

I call this function in the constructor of the frame Object. Pic is in same folder as the class. Frame appears but NO icon is shown (just blue Titlebar)

2:
this.setIconImage( new ImageIcon( Classloader.getSystemResource("pic.gif")).getImage());

brings up a NULL pointer Error :(

3:
this.setIconImage(Toolkit.getDefaultToolkit().getImage(packetName + "pic.gif"));

where packetName is the full packet path.

this on e also gets me an NULL pointer Error.


I dont know what to do anymore. Please help! THanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 27 2005
Added on Dec 13 2002
6 comments
238 views