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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Exception after setting jdbc session management 2 52
Starting to learn JAVA, 7 59
get weblogic logged in user in java 2 57
github account with ecipse 1 42
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

911 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

21 Experts available now in Live!

Get 1:1 Help Now