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?
SimpleJavaAsked:
Who is Participating?
 
CEHJConnect With a Mentor Commented:
try

setImageIcon(new ImageIcon("your.jpg").getImage());
0
 
CEHJCommented:
Try

setIconImage(Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("images/your.jpg")));
0
 
riaancorneliusCommented:
>
just change the imageicon for the frame, it get's scaled, but 16X16 pixels is usualy good
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
riaancorneliusCommented:
btw, java will load most of the popular image formats using CEHJ's method
0
 
SimpleJavaAuthor Commented:
Thanks but i'm getting an uncaught error fetching image which says something about java.lang.NullPointerException
0
 
SimpleJavaAuthor Commented:
I have the image in the same directory as the main class to give some further information
0
 
SimpleJavaAuthor Commented:
> just change the image icon for the frame
riaancornelius where is the image icon for the frame located ?
0
 
SimpleJavaAuthor Commented:
method setImageIcon() cannot be resolved!!!!
0
 
SimpleJavaAuthor Commented:
>> 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 ?
0
 
CEHJCommented:
>>But where is the image for the frame located ?

Not sure but wouldn't be surprised if it were in a runtime binary
0
 
SimpleJavaAuthor Commented:
Thank you. Will try and find out.
0
 
CEHJCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.