Changing system menu icon of JFrame

Posted on 2000-04-06
Last Modified: 2008-01-16

I would like the icon for the system menu of a JFrame changed to my own custom icon. What I need to know is what kind of image file I need for the icon. Can a .GIF file do? And what resolution should it be?

Also, suppose my java application runs on a Windows system, and I want to create a custom desktop icon to launch my application. How do I make that icon? From what I can tell from a normal .EXE program, the icon is stored inside the .EXE file.
Question by:yongsing
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
LVL 16

Accepted Solution

heyhey_ earned 20 total points
ID: 2692190
ImageIcon icon = new ImageIcon("system.gif");

Author Comment

ID: 2692765
But what pixel resolution should the system.gif file be? Should it be 16 x 16 or 32 x 32?
LVL 16

Expert Comment

ID: 2692933
I suppose that the image will be automatically resized ...

public synchronized void setIconImage(Image image)

Sets the image to display when this frame is iconized. Not all platforms support the concept of iconizing a window.

image - the icon image to be displayed

Expert Comment

ID: 2692947
You can use frame.getIconImage() to get the default one and check its size, but there are probably better solutions :-)
LVL 16

Expert Comment

ID: 2693086

well, actually I don't remember the size ... :) but I suppose that every Image object will be automatically resized.

Featured Post

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!

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…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
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…
The viewer will learn how to implement Singleton Design Pattern in Java.

717 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