• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1087
  • Last Modified:

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?
0
BugLighter
Asked:
BugLighter
  • 4
  • 4
1 Solution
 
heyhey_Commented:
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
0
 
BugLighterAuthor Commented:
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?
0
 
heyhey_Commented:
Image image = toolkit.getDefaultToolkit().getImage(String gifFilename);

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

frame.setIconImage(image);
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
BugLighterAuthor Commented:
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?
0
 
BugLighterAuthor Commented:
hey_hey,
I have found it already,
but thanks for the rapid help..:-)

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

BugLighter.
0
 
heyhey_Commented:
Thanks
0
 
BugLighterAuthor Commented:
May I use it with *.bmp files also?
should I give the full path "c:\icon.BMP"?

0
 
heyhey_Commented:
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)
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now