Solved

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

Posted on 2009-03-29
6
1,118 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 17

Accepted Solution

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn different types of Android Layout and some basics of an Android App.
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

623 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