mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 22:47:13 -06:00
TabbedPane: support hiding tab area if it contains only one tab
This commit is contained in:
@@ -78,6 +78,11 @@ public class FlatContainerTest
|
||||
putTabbedPanesClientProperty( TABBED_PANE_SHOW_CONTENT_SEPARATOR, showContentSeparator );
|
||||
}
|
||||
|
||||
private void hideTabAreaWithOneTabChanged() {
|
||||
boolean hideTabAreaWithOneTab = hideTabAreaWithOneTabCheckBox.isSelected();
|
||||
putTabbedPanesClientProperty( TABBED_PANE_HIDE_TAB_AREA_WITH_ONE_TAB, hideTabAreaWithOneTab );
|
||||
}
|
||||
|
||||
private void hasFullBorderChanged() {
|
||||
Boolean hasFullBorder = hasFullBorderCheckBox.isSelected() ? true : null;
|
||||
putTabbedPanesClientProperty( TABBED_PANE_HAS_FULL_BORDER, hasFullBorder );
|
||||
@@ -461,6 +466,7 @@ public class FlatContainerTest
|
||||
maximumTabWidthCheckBox = new JCheckBox();
|
||||
showTabSeparatorsCheckBox = new JCheckBox();
|
||||
secondTabWiderCheckBox = new JCheckBox();
|
||||
hideTabAreaWithOneTabCheckBox = new JCheckBox();
|
||||
CellConstraints cc = new CellConstraints();
|
||||
|
||||
//======== this ========
|
||||
@@ -579,6 +585,7 @@ public class FlatContainerTest
|
||||
"[]" +
|
||||
"[]para" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]"));
|
||||
|
||||
//---- tabScrollCheckBox ----
|
||||
@@ -800,6 +807,11 @@ public class FlatContainerTest
|
||||
secondTabWiderCheckBox.setText("Second Tab insets wider (4,20,4,20)");
|
||||
secondTabWiderCheckBox.addActionListener(e -> secondTabWiderChanged());
|
||||
tabbedPaneControlPanel.add(secondTabWiderCheckBox, "cell 2 9");
|
||||
|
||||
//---- hideTabAreaWithOneTabCheckBox ----
|
||||
hideTabAreaWithOneTabCheckBox.setText("Hide tab area with one tab");
|
||||
hideTabAreaWithOneTabCheckBox.addActionListener(e -> hideTabAreaWithOneTabChanged());
|
||||
tabbedPaneControlPanel.add(hideTabAreaWithOneTabCheckBox, "cell 1 10");
|
||||
}
|
||||
panel9.add(tabbedPaneControlPanel, cc.xywh(1, 11, 3, 1));
|
||||
}
|
||||
@@ -844,6 +856,7 @@ public class FlatContainerTest
|
||||
private JCheckBox maximumTabWidthCheckBox;
|
||||
private JCheckBox showTabSeparatorsCheckBox;
|
||||
private JCheckBox secondTabWiderCheckBox;
|
||||
private JCheckBox hideTabAreaWithOneTabCheckBox;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
|
||||
private JTabbedPane[] allTabbedPanes;
|
||||
|
||||
@@ -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[][][]"
|
||||
} ) {
|
||||
name: "tabbedPaneControlPanel"
|
||||
"opaque": false
|
||||
@@ -547,6 +547,16 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 9"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "hideTabAreaWithOneTabCheckBox"
|
||||
"text": "Hide tab area with one tab"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hideTabAreaWithOneTabChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 10"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
|
||||
"gridY": 11
|
||||
"gridWidth": 3
|
||||
|
||||
Reference in New Issue
Block a user