Changing a Java Frame's close/min/max icons

Posted on 2009-03-29
Last Modified: 2013-12-22
I have an application that uses a JFrame as the main window for the app. I am using swing plaf to change certain things about how the frame looks and how the components look, for example:
   String dLook = UIManager.getSystemLookAndFeelClassName();
   UIManager.put("ScrollBar.highlight",new ColorUIResource(255,0,0));
   UIManager.put("TextPane.font", new FontUIResource("Dialog", Font.PLAIN, 14));

What I'd like to do is to change the default icons for close/minimize/maximize on my Frame/windowsTitle (I'm not sure which one am I actually referring to, but they are the ones at the top right of every window.)       I saw a bunch of JInternalFrame properties to edit, but none for the overall frame (External frame?)  I want to set the icons for things like close, close_pressed, and close_mouse_over to my own png images.
Question by:bored_shiva
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
  • 2
  • 2
  • 2
LVL 12

Expert Comment

ID: 24011926

Author Comment

ID: 24011983
That solution lets you modify the frame icon (on the upper left) I want to modify the CLOSE, MIN, and MAX, icons, on the upper right.
I know this is possible, because I see skin engines like skinlf do it. The question is how to do it using the built-in Java tools.

LVL 12

Expert Comment

ID: 24012048
oops... I overlooked at your question :)
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!

LVL 17

Accepted Solution

Thomas4019 earned 250 total points
ID: 24014774
If you are making this many changes to the UI of the window border. You might as well, setUndecorated(true) for your JFrame. This makes it you window have not border and no buttons by default. Just a completely blank window for which you create your own complete window border and toolbar.

Author Comment

ID: 24016616
How do I go about creating my own WindowsBorder? I saw that JRootPane can specify different WindowsDecorationStyles that are built into it, but I was not able to find how to create my own style.
LVL 17

Expert Comment

ID: 24024575
To create you own border, the way i recommend is overriding the paint method. Then you have a graphics object and have complete control over what to draw and where. If you have never overrided the paint method before i can post an example.

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Selenium docs api java index 3 98
Setup GlassFish 4 55
What is the use of Forwarding Class in java 1 54
Java regex 5 22
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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses

751 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