• Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting the icon on the main frame of an application  RSS feed

 
Catriona McCann
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi !
I would like to know how you can set the icon of an application to your own gif rather than the standard.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this:
myFrame.setIconImage(myImage);
JFrame inherits this method from java.awt.Frame
 
alexander Petrovich
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
or if you know the name of file do it directly:!!!
setIconImage(Toolkit.getDefaultToolkit().getImage("image.gif"));
alex from http://javafaq.nu
 
Brian Beare
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Alexander - your suggestion, unlike some others that use ImageIcon, also work when scripting Java in the Mozilla Rhino JavaScript interpreter.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Blue Boy
Welcome to Javaranch! We don't have too many rules around here but we do have a Naming Policy. Please adjust your display name accordingly.
You can change your display name here
Thanks and hope to see you around.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!