Solved

java.awt.Frame and setIconImage(Image image)

Posted on 1998-01-15
6
872 Views
Last Modified: 2008-02-01
I want to set the icon of my Frame object to be an specific .ico file which I have on my local file system.  I know that java.awt.Frame has setIconImage, but I am having a problem creating an Image object.  How do I create an Image object to be my icon?

The name of the icon is rocket.ico, and it is located in C:\Myjava.
0
Comment
Question by:bjg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 

Accepted Solution

by:
rjg2000 earned 50 total points
ID: 1232227
To the best of my knowledge

Java cannot read .ico files.
Convert is to a gif using Paint Shop Pro
and then load that image in the normal way.
0
 

Author Comment

by:bjg
ID: 1232228
What is the normal way to load an .gif image?
0
 

Expert Comment

by:rjg2000
ID: 1232229
Applets
-------
      Image i = this.getImage(this.getDocumentBase(),"image.gif");

Applications
------------
Toolkit tk = Toolkit.getDefaultToolkit();
Image i = tk.loadImage(filename);

you may want to use a MediaTracker to check the image has
finished loaded before calling setIconImage


0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:bjg
ID: 1232230
It's getImage, not loadImage, but thanks, it worked.
0
 

Author Comment

by:bjg
ID: 1232231
By the way, how does PaintShopPro convert an icon to a gif?  I tried it and PaintShopPro says that .ico is unrecognized file type.
0
 

Expert Comment

by:rjg2000
ID: 1232232
Umm,  Ok, got it wrong there, I belive that paintbrush can
handle .ico files.  You will then have to save it as a bitmap
(or just copy it into the clipboard) and the place it it PSP to
save it as a .gif (As paintbush does not support gifs!)

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to implement Singleton Design Pattern in Java.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question