mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 06:57:13 -06:00
TabbedPane: support minimum and maximum tab widths
This commit is contained in:
@@ -323,6 +323,16 @@ public class FlatContainerTest
|
||||
}
|
||||
}
|
||||
|
||||
private void minimumTabWidthChanged() {
|
||||
Integer minimumTabWidth = minimumTabWidthCheckBox.isSelected() ? 100 : null;
|
||||
putTabbedPanesClientProperty( TABBED_PANE_MINIMUM_TAB_WIDTH, minimumTabWidth );
|
||||
}
|
||||
|
||||
private void maximumTabWidthChanged() {
|
||||
Integer maximumTabWidth = maximumTabWidthCheckBox.isSelected() ? 60 : null;
|
||||
putTabbedPanesClientProperty( TABBED_PANE_MAXIMUM_TAB_WIDTH, maximumTabWidth );
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||
JPanel panel9 = new JPanel();
|
||||
@@ -365,6 +375,8 @@ public class FlatContainerTest
|
||||
trailingComponentCheckBox = new JCheckBox();
|
||||
showTabSeparatorsCheckBox = new JCheckBox();
|
||||
secondTabWiderCheckBox = new JCheckBox();
|
||||
minimumTabWidthCheckBox = new JCheckBox();
|
||||
maximumTabWidthCheckBox = new JCheckBox();
|
||||
CellConstraints cc = new CellConstraints();
|
||||
|
||||
//======== this ========
|
||||
@@ -480,6 +492,8 @@ public class FlatContainerTest
|
||||
"[]" +
|
||||
"[]para" +
|
||||
"[]" +
|
||||
"[]para" +
|
||||
"[]" +
|
||||
"[]"));
|
||||
|
||||
//---- tabScrollCheckBox ----
|
||||
@@ -605,6 +619,16 @@ public class FlatContainerTest
|
||||
secondTabWiderCheckBox.setText("Second Tab insets wider (4,20,4,20)");
|
||||
secondTabWiderCheckBox.addActionListener(e -> secondTabWiderChanged());
|
||||
tabbedPaneControlPanel.add(secondTabWiderCheckBox, "cell 2 6");
|
||||
|
||||
//---- minimumTabWidthCheckBox ----
|
||||
minimumTabWidthCheckBox.setText("Minimum tab width (100)");
|
||||
minimumTabWidthCheckBox.addActionListener(e -> minimumTabWidthChanged());
|
||||
tabbedPaneControlPanel.add(minimumTabWidthCheckBox, "cell 2 7");
|
||||
|
||||
//---- maximumTabWidthCheckBox ----
|
||||
maximumTabWidthCheckBox.setText("Maximum tab width (60)");
|
||||
maximumTabWidthCheckBox.addActionListener(e -> maximumTabWidthChanged());
|
||||
tabbedPaneControlPanel.add(maximumTabWidthCheckBox, "cell 2 8");
|
||||
}
|
||||
panel9.add(tabbedPaneControlPanel, cc.xywh(1, 11, 3, 1));
|
||||
}
|
||||
@@ -637,6 +661,8 @@ public class FlatContainerTest
|
||||
private JCheckBox trailingComponentCheckBox;
|
||||
private JCheckBox showTabSeparatorsCheckBox;
|
||||
private JCheckBox secondTabWiderCheckBox;
|
||||
private JCheckBox minimumTabWidthCheckBox;
|
||||
private JCheckBox maximumTabWidthCheckBox;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
|
||||
//---- class Tab1Panel ----------------------------------------------------
|
||||
|
||||
@@ -132,7 +132,7 @@ new FormModel {
|
||||
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestFrame$NoRightToLeftPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets 0,hidemode 3"
|
||||
"$columnConstraints": "[][fill][]"
|
||||
"$rowConstraints": "[center][][]para[][]para[][]"
|
||||
"$rowConstraints": "[center][][]para[][]para[][]para[][]"
|
||||
} ) {
|
||||
name: "tabbedPaneControlPanel"
|
||||
"opaque": false
|
||||
@@ -381,6 +381,26 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 6"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "minimumTabWidthCheckBox"
|
||||
"text": "Minimum tab width (100)"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "minimumTabWidthChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 7"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "maximumTabWidthCheckBox"
|
||||
"text": "Maximum tab width (60)"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "maximumTabWidthChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 8"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
|
||||
"gridY": 11
|
||||
"gridWidth": 3
|
||||
|
||||
Reference in New Issue
Block a user