mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 06:57:13 -06:00
Window decorations:
- support customizing of window title alignment: left aligned or centered (default is left without embedded menubar and centered with embedded menubar) - improved centering of window title with embedded menubar (issue #252)
This commit is contained in:
@@ -189,6 +189,14 @@ public class FlatWindowDecorationsTest
|
||||
menuBar.getMenu( menuCount - 1 ).setText( text );
|
||||
}
|
||||
|
||||
private void changeTitle() {
|
||||
Window window = SwingUtilities.windowForComponent( this );
|
||||
if( window instanceof Frame )
|
||||
((Frame)window).setTitle( ((Frame)window).getTitle() + " bla" );
|
||||
else if( window instanceof Dialog )
|
||||
((Dialog)window).setTitle( ((Dialog)window).getTitle() + " bla" );
|
||||
}
|
||||
|
||||
private void resizableChanged() {
|
||||
Window window = SwingUtilities.windowForComponent( this );
|
||||
if( window instanceof Frame )
|
||||
@@ -308,6 +316,8 @@ public class FlatWindowDecorationsTest
|
||||
colorizeMenusCheckBox = new JCheckBox();
|
||||
resizableCheckBox = new JCheckBox();
|
||||
maximizedBoundsCheckBox = new JCheckBox();
|
||||
JPanel hSpacer1 = new JPanel(null);
|
||||
JButton changeTitleButton = new JButton();
|
||||
undecoratedCheckBox = new JCheckBox();
|
||||
fullScreenCheckBox = new JCheckBox();
|
||||
JLabel label1 = new JLabel();
|
||||
@@ -428,6 +438,12 @@ public class FlatWindowDecorationsTest
|
||||
maximizedBoundsCheckBox.setText("maximized bounds (50,100, 1000,700)");
|
||||
maximizedBoundsCheckBox.addActionListener(e -> maximizedBoundsChanged());
|
||||
add(maximizedBoundsCheckBox, "cell 1 3");
|
||||
add(hSpacer1, "cell 1 3,growx");
|
||||
|
||||
//---- changeTitleButton ----
|
||||
changeTitleButton.setText("Change title");
|
||||
changeTitleButton.addActionListener(e -> changeTitle());
|
||||
add(changeTitleButton, "cell 1 3");
|
||||
|
||||
//---- undecoratedCheckBox ----
|
||||
undecoratedCheckBox.setText("undecorated");
|
||||
|
||||
@@ -123,6 +123,18 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 3"
|
||||
} )
|
||||
add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) {
|
||||
name: "hSpacer1"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 3,growx"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "changeTitleButton"
|
||||
"text": "Change title"
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "changeTitle", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 3"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "undecoratedCheckBox"
|
||||
"text": "undecorated"
|
||||
@@ -316,7 +328,7 @@ new FormModel {
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
"size": new java.awt.Dimension( 550, 440 )
|
||||
"size": new java.awt.Dimension( 580, 440 )
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JMenuBar", new FormLayoutManager( class javax.swing.JMenuBar ) ) {
|
||||
name: "menuBar"
|
||||
|
||||
Reference in New Issue
Block a user