File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Setting the icon on the main frame of an application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Setting the icon on the main frame of an application" Watch "Setting the icon on the main frame of an application" New topic
Author

Setting the icon on the main frame of an application

Catriona McCann
Greenhorn

Joined: Aug 31, 2000
Posts: 24
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

Joined: May 05, 2000
Posts: 13974
try this:
myFrame.setIconImage(myImage);
JFrame inherits this method from java.awt.Frame

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
alexander Petrovich
Greenhorn

Joined: Jul 31, 2000
Posts: 12
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

Joined: Feb 23, 2004
Posts: 1
Thank you Alexander - your suggestion, unlike some others that use ImageIcon, also work when scripting Java in the Mozilla Rhino JavaScript interpreter.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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.


GenRocket - Experts at Building Test Data
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Setting the icon on the main frame of an application