Link to home
Start Free TrialLog in
Avatar of BugLighter
BugLighter

asked on

ICONS and windows

Using sdk2, swing.

How can I overide java's icon with  an incon ( ico file ) on a window (JFrame, JDialog).

Is *.ico file are standard icon files for non-microsoft platforms?
Avatar of heyhey_
heyhey_

1. convert .ico to .gif

2. use
- Class Frame -
public void setIconImage(Image image)
Sets the image to displayed in the minimized icon for this frame. Not all platforms support the concept of minimizing a window.

as far as I remember Dialogs use their parent Frame Image
Avatar of BugLighter

ASKER

I did not understand how to use the setIconImage method
say I have an icon.GIF file how do i set it as a frame icon?
Image image = toolkit.getDefaultToolkit().getImage(String gifFilename);

// or
// Image image = toolkit.getDefaultToolkit().getImage(URL gifURL);

frame.setIconImage(image);
I did not understand how to use the setIconImage method
say I have an icon.GIF file how do i set it as a frame icon?
hey_hey,
I have found it already,
but thanks for the rapid help..:-)

post an answer and I'll give you the points.

BugLighter.
ASKER CERTIFIED SOLUTION
Avatar of heyhey_
heyhey_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
May I use it with *.bmp files also?
should I give the full path "c:\icon.BMP"?

you can't use .bmp files directly from Java. you should convert it to .gif (or .jpg) ro implement your own BMPImageLoader (there is nice article at www.javasoft.com)