Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

java.awt.Frame and setIconImage(Image image)

Posted on 1998-01-15
6
Medium Priority
?
918 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

609 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