Solved

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

Posted on 2009-03-29
6
1,101 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
  • 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
What Security Threats Are You Missing?

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.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
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 learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

707 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

16 Experts available now in Live!

Get 1:1 Help Now