?
Solved

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

Posted on 2009-03-29
6
Medium Priority
?
1,126 Views
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));
   UIManager.setLookAndFeel(dLook);                        

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.
Thanks
0
Comment
Question by:bored_shiva
[X]
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
6 Comments
 
LVL 12

Expert Comment

by:basav_com
ID: 24011926
0
 

Author Comment

by:bored_shiva
ID: 24011983
basav_com,
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.

Thanks
0
 
LVL 12

Expert Comment

by:basav_com
ID: 24012048
oops... I overlooked at your question :)
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 17

Accepted Solution

by:
Thomas4019 earned 750 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.
0
 

Author Comment

by:bored_shiva
ID: 24016616
Thomas,
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.
Thanks
0
 
LVL 17

Expert Comment

by:Thomas4019
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.
0

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

719 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