Solved

java.awt.Frame and setIconImage(Image image)

Posted on 1998-01-15
6
848 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
  • 3
  • 3
6 Comments
 

Accepted Solution

by:
rjg2000 earned 50 total points
Comment Utility
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
Comment Utility
What is the normal way to load an .gif image?
0
 

Expert Comment

by:rjg2000
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

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

Author Comment

by:bjg
Comment Utility
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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
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…
This video teaches viewers about errors in exception handling.

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now