mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 22:40:53 +03:00
TabbedPane: support separators between tabs (TabbedPane.showTabSeparators)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
package com.formdev.flatlaf.testing;
|
||||
|
||||
import static com.formdev.flatlaf.FlatClientProperties.TABBED_PANE_HAS_FULL_BORDER;
|
||||
import static com.formdev.flatlaf.FlatClientProperties.TABBED_PANE_SHOW_TAB_SEPARATORS;
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.*;
|
||||
@@ -36,6 +37,14 @@ public class FlatContainerTest
|
||||
tabbedPane4.setTabLayoutPolicy( tabLayoutPolicy );
|
||||
}
|
||||
|
||||
private void showTabSeparatorsChanged() {
|
||||
Boolean showTabSeparators = showTabSeparatorsCheckBox.isSelected() ? true : null;
|
||||
tabbedPane1.putClientProperty( TABBED_PANE_SHOW_TAB_SEPARATORS, showTabSeparators );
|
||||
tabbedPane2.putClientProperty( TABBED_PANE_SHOW_TAB_SEPARATORS, showTabSeparators );
|
||||
tabbedPane3.putClientProperty( TABBED_PANE_SHOW_TAB_SEPARATORS, showTabSeparators );
|
||||
tabbedPane4.putClientProperty( TABBED_PANE_SHOW_TAB_SEPARATORS, showTabSeparators );
|
||||
}
|
||||
|
||||
private void hasFullBorderChanged() {
|
||||
Boolean hasFullBorder = hasFullBorderCheckBox.isSelected() ? true : null;
|
||||
tabbedPane1.putClientProperty( TABBED_PANE_HAS_FULL_BORDER, hasFullBorder );
|
||||
@@ -100,6 +109,7 @@ public class FlatContainerTest
|
||||
JPanel panel14 = new JPanel();
|
||||
moreTabsCheckBox = new JCheckBox();
|
||||
tabScrollCheckBox = new JCheckBox();
|
||||
showTabSeparatorsCheckBox = new JCheckBox();
|
||||
hasFullBorderCheckBox = new JCheckBox();
|
||||
CellConstraints cc = new CellConstraints();
|
||||
|
||||
@@ -291,6 +301,7 @@ public class FlatContainerTest
|
||||
// columns
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]",
|
||||
// rows
|
||||
"[center]"));
|
||||
@@ -307,11 +318,16 @@ public class FlatContainerTest
|
||||
tabScrollCheckBox.addActionListener(e -> tabScrollChanged());
|
||||
panel14.add(tabScrollCheckBox, "cell 1 0,alignx left,growx 0");
|
||||
|
||||
//---- showTabSeparatorsCheckBox ----
|
||||
showTabSeparatorsCheckBox.setText("JTabbedPane.showTabSeparators");
|
||||
showTabSeparatorsCheckBox.addActionListener(e -> showTabSeparatorsChanged());
|
||||
panel14.add(showTabSeparatorsCheckBox, "cell 2 0");
|
||||
|
||||
//---- hasFullBorderCheckBox ----
|
||||
hasFullBorderCheckBox.setText("JTabbedPane.hasFullBorder");
|
||||
hasFullBorderCheckBox.setMnemonic('F');
|
||||
hasFullBorderCheckBox.addActionListener(e -> hasFullBorderChanged());
|
||||
panel14.add(hasFullBorderCheckBox, "cell 2 0,alignx left,growx 0");
|
||||
panel14.add(hasFullBorderCheckBox, "cell 3 0,alignx left,growx 0");
|
||||
}
|
||||
panel9.add(panel14, cc.xywh(1, 11, 3, 1));
|
||||
}
|
||||
@@ -326,6 +342,7 @@ public class FlatContainerTest
|
||||
private JTabbedPane tabbedPane4;
|
||||
private JCheckBox moreTabsCheckBox;
|
||||
private JCheckBox tabScrollCheckBox;
|
||||
private JCheckBox showTabSeparatorsCheckBox;
|
||||
private JCheckBox hasFullBorderCheckBox;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ new FormModel {
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets 0,hidemode 3"
|
||||
"$columnConstraints": "[][][]"
|
||||
"$columnConstraints": "[][][][]"
|
||||
"$rowConstraints": "[center]"
|
||||
} ) {
|
||||
name: "panel14"
|
||||
@@ -227,6 +227,16 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0,alignx left,growx 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "showTabSeparatorsCheckBox"
|
||||
"text": "JTabbedPane.showTabSeparators"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showTabSeparatorsChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "hasFullBorderCheckBox"
|
||||
"text": "JTabbedPane.hasFullBorder"
|
||||
@@ -236,7 +246,7 @@ new FormModel {
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hasFullBorderChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 0,alignx left,growx 0"
|
||||
"value": "cell 3 0,alignx left,growx 0"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
|
||||
"gridY": 11
|
||||
@@ -247,7 +257,7 @@ new FormModel {
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
"size": new java.awt.Dimension( 500, 515 )
|
||||
"size": new java.awt.Dimension( 625, 515 )
|
||||
} )
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,6 +235,7 @@ TabbedPane.underlineColor=#4A88C7
|
||||
TabbedPane.disabledUnderlineColor=#7a7a7a
|
||||
TabbedPane.hoverColor=#eeeeee
|
||||
TabbedPane.focusColor=#dddddd
|
||||
TabbedPane.tabSeparatorColor=#00f
|
||||
TabbedPane.contentAreaColor=#bbbbbb
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user