Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I customize the title bar on JFrame?

I would like to have a customized title bar in my Java Swing desktop application. What is the best way to do that? I can use a "Swing-title bar" by using the following code in the constructor for my JFrame:

this.setUndecorated(true);
this.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);

But how do I customize it? Is there any UI delegates that I can override or do I have to implement my own title bar from scratch?

I want something like Lawson Smart Office: Lawson Smart Office

like image 759
Jonas Avatar asked May 06 '10 14:05

Jonas


People also ask

How can I change the color of the title bar in JFrame?

put("JFrame. activeTitleBackground", Color. red); for change the toolbar color in JFrame.

How do I add a title to a JFrame?

To set the title of a JFrame, you can use JFrame. setTitle(String title) method.

Can you add buttons to JFrame?

In a Java JFrame, we can add an instance of a JButton class, which creates a button on the frame as follows in the code below: //add a button. JButton b = new JButton("Submit"); b.


1 Answers

You can see an example in Substance look-and-feel (mirrored source). Search the code for SubstanceRootPaneUI and SubstanceTitlePane. The implementation depends on other classes in Substance, and will not be easy to reuse outside the specific library - nor is it meant to.

like image 179
Kirill Avatar answered Oct 04 '22 04:10

Kirill