Link to home
Start Free TrialLog in
Avatar of SimpleJava
SimpleJava

asked on

Java cup of tea icon

Hi experts
How can i replace the small java cup of tea icon that shows on JFrames with my own icon say in .jpg format ? How do i know the actual size of this tiny image and in which format is it?
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Try

setIconImage(Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("images/your.jpg")));
Avatar of riaancornelius
riaancornelius

>
just change the imageicon for the frame, it get's scaled, but 16X16 pixels is usualy good
btw, java will load most of the popular image formats using CEHJ's method
Avatar of SimpleJava

ASKER

Thanks but i'm getting an uncaught error fetching image which says something about java.lang.NullPointerException
I have the image in the same directory as the main class to give some further information
> just change the image icon for the frame
riaancornelius where is the image icon for the frame located ?
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
method setImageIcon() cannot be resolved!!!!
>> correction your setImageIcon() is supposed to be setIconImage().=)
i guess it was a typo.
Works fine. Thank you CEHJ.
But where is the image for the frame located ?
>>But where is the image for the frame located ?

Not sure but wouldn't be surprised if it were in a runtime binary
Thank you. Will try and find out.
:-)