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
Comment Utility
ImageIcon icon = new ImageIcon("system.gif");

Author Comment

Comment Utility
But what pixel resolution should the system.gif file be? Should it be 16 x 16 or 32 x 32?
LVL 16

Expert Comment

Comment Utility
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

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

Expert Comment

Comment Utility

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

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
factorial example challenge 10 60
bunnyEars challenge 6 62
count7 challenge 12 66
maven example error 3 34
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…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

762 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