The Artima Developer Community
Sponsored Link

Java Answers Forum
Change the Icon of the JFrame

1 reply on 1 page. Most recent reply: Jun 27, 2002 8:12 AM by Tarba Dan

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Trung

Posts: 9
Nickname: chitrung
Registered: Jun, 2002

Change the Icon of the JFrame Posted: Jun 26, 2002 4:07 AM
Reply to this message Reply
Advertisement
Hi guys!

I am the first time here and would like to know if someone can tell me how or if it is possible to change the icon (that cup of coffee icon from sun) from the Frames.

I come from asian, so sorry for my bad english.

much of thanks,
Trung


Tarba Dan

Posts: 11
Nickname: dtarba
Registered: May, 2002

Re: Change the Icon of the JFrame Posted: Jun 27, 2002 8:12 AM
Reply to this message Reply
You need a gif image wich reprezents your icon image. Use the class ImageIcon to create your icon.
ImageIcon icon=new ImageIcon(image.gif);

Then use setIconImage method from JFrame to change the icon - you can call the method in the constructor like this :
setIconImage(icon);


For more help about Java classes see the Java Api Documentation at www.java.sun.com.

Flat View: This topic has 1 reply on 1 page
Topic: Exceptions Previous Topic   Next Topic Topic: Displaying image in JPanel

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use