mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 14:00:55 +03:00
FlatLaf window decorations: strech iconify/maximize/close buttons to always fill whole title bar height (issue #897)
This commit is contained in:
@@ -189,6 +189,7 @@ public class FlatWindowDecorationsTest
|
||||
|
||||
if( rightCompCheckBox.isSelected() ) {
|
||||
rightStretchCompCheckBox.setSelected( false );
|
||||
tallCompCheckBox.setSelected( false );
|
||||
|
||||
JButton myButton = new JButton( "?" );
|
||||
myButton.putClientProperty( "JButton.buttonType", "toolBarButton" );
|
||||
@@ -207,6 +208,7 @@ public class FlatWindowDecorationsTest
|
||||
|
||||
if( rightStretchCompCheckBox.isSelected() ) {
|
||||
rightCompCheckBox.setSelected( false );
|
||||
tallCompCheckBox.setSelected( false );
|
||||
|
||||
menuBar.add( Box.createGlue() );
|
||||
menuBar.add( new JProgressBar() );
|
||||
@@ -216,6 +218,20 @@ public class FlatWindowDecorationsTest
|
||||
menuBar.repaint();
|
||||
}
|
||||
|
||||
private void tallCompChanged() {
|
||||
removeNonMenusFromMenuBar();
|
||||
|
||||
if( tallCompCheckBox.isSelected() ) {
|
||||
rightCompCheckBox.setSelected( false );
|
||||
rightStretchCompCheckBox.setSelected( false );
|
||||
|
||||
menuBar.add( new JButton( "<html>large<br>button<br>large<br>button</html>" ) );
|
||||
}
|
||||
|
||||
menuBar.revalidate();
|
||||
menuBar.repaint();
|
||||
}
|
||||
|
||||
private void removeNonMenusFromMenuBar() {
|
||||
Component[] components = menuBar.getComponents();
|
||||
for( int i = components.length - 1; i >= 0; i-- ) {
|
||||
@@ -585,6 +601,7 @@ debug*/
|
||||
menuBarVisibleCheckBox = new JCheckBox();
|
||||
rightCompCheckBox = new JCheckBox();
|
||||
rightStretchCompCheckBox = new JCheckBox();
|
||||
tallCompCheckBox = new JCheckBox();
|
||||
JPanel panel3 = new JPanel();
|
||||
addMenuButton = new JButton();
|
||||
addGlueButton = new JButton();
|
||||
@@ -777,6 +794,7 @@ debug*/
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]"));
|
||||
|
||||
//---- menuBarCheckBox ----
|
||||
@@ -806,6 +824,11 @@ debug*/
|
||||
rightStretchCompCheckBox.setText("right aligned stretching component");
|
||||
rightStretchCompCheckBox.addActionListener(e -> rightStretchCompChanged());
|
||||
panel6.add(rightStretchCompCheckBox, "cell 0 4");
|
||||
|
||||
//---- tallCompCheckBox ----
|
||||
tallCompCheckBox.setText("tall component");
|
||||
tallCompCheckBox.addActionListener(e -> tallCompChanged());
|
||||
panel6.add(tallCompCheckBox, "cell 0 5");
|
||||
}
|
||||
add(panel6, "cell 2 0");
|
||||
|
||||
@@ -1254,6 +1277,7 @@ debug*/
|
||||
private JCheckBox menuBarVisibleCheckBox;
|
||||
private JCheckBox rightCompCheckBox;
|
||||
private JCheckBox rightStretchCompCheckBox;
|
||||
private JCheckBox tallCompCheckBox;
|
||||
private JButton addMenuButton;
|
||||
private JButton addGlueButton;
|
||||
private JButton addCaptionButton;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "8.2.1.0.348" Java: "21.0.1" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "8.2.3.0.386" Java: "21" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -166,7 +166,7 @@ new FormModel {
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "ltr,hidemode 3,gap 0 0"
|
||||
"$columnConstraints": "[left]"
|
||||
"$rowConstraints": "[][][][][]"
|
||||
"$rowConstraints": "[][][][][][]"
|
||||
} ) {
|
||||
name: "panel6"
|
||||
"border": new javax.swing.border.TitledBorder( "Menu Bar" )
|
||||
@@ -223,6 +223,16 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 4"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "tallCompCheckBox"
|
||||
"text": "tall component"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tallCompChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 5"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 0"
|
||||
} )
|
||||
|
||||
Reference in New Issue
Block a user