?
Solved

java.awt.Frame and setIconImage(Image image)

Posted on 1998-01-15
6
Medium Priority
?
905 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 200 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
Industry Leaders: 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month11 days, 10 hours left to enroll

752 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