TabbedPane: completed review of PR #343 (active tab border painting style)

- replaced `activeTabBorder` with `tabType`
- added `TabbedPane.cardTabSelectionHeight`
This commit is contained in:
Karl Tauber
2021-11-18 16:47:21 +01:00
parent 435cf05f9f
commit 3cfa16b8b7
12 changed files with 270 additions and 86 deletions

View File

@@ -14,8 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
package com.formdev.flatlaf; package com.formdev.flatlaf;
import java.awt.Color; import java.awt.Color;
import java.util.Objects; import java.util.Objects;
import javax.swing.JComponent; import javax.swing.JComponent;
@@ -324,6 +324,35 @@ public interface FlatClientProperties
//---- JTabbedPane -------------------------------------------------------- //---- JTabbedPane --------------------------------------------------------
/**
* Specifies type of the selected tab.
* <p>
* <strong>Component</strong> {@link javax.swing.JTabbedPane}<br>
* <strong>Value type</strong> {@link java.lang.String}<br>
* <strong>Allowed Values</strong>
* {@link #TABBED_PANE_TAB_TYPE_UNDERLINED} or
* {@link #TABBED_PANE_TAB_TYPE_CARD}
*
* @since 2
*/
String TABBED_PANE_TAB_TYPE = "JTabbedPane.tabType";
/**
* Paint the selected tab underlined.
*
* @see #TABBED_PANE_TAB_TYPE
* @since 2
*/
String TABBED_PANE_TAB_TYPE_UNDERLINED = "underlined";
/**
* Paint the selected tab as card.
*
* @see #TABBED_PANE_TAB_TYPE
* @since 2
*/
String TABBED_PANE_TAB_TYPE_CARD = "card";
/** /**
* Specifies whether separators are shown between tabs. * Specifies whether separators are shown between tabs.
* <p> * <p>
@@ -332,15 +361,6 @@ public interface FlatClientProperties
*/ */
String TABBED_PANE_SHOW_TAB_SEPARATORS = "JTabbedPane.showTabSeparators"; String TABBED_PANE_SHOW_TAB_SEPARATORS = "JTabbedPane.showTabSeparators";
/**
* Specifies whether a border is painted around the active tab.
* This also changes position of the active tab indicator.
* <p>
* <strong>Component</strong> {@link javax.swing.JTabbedPane}<br>
* <strong>Value type</strong> {@link java.lang.Boolean}
*/
String TABBED_PANE_ACTIVE_TAB_BORDER = "JTabbedPane.activeTabBorder";
/** /**
* Specifies whether the separator between tabs area and content area should be shown. * Specifies whether the separator between tabs area and content area should be shown.
* <p> * <p>

View File

@@ -97,7 +97,6 @@ import com.formdev.flatlaf.util.UIScale;
* *
* @clientProperty JTabbedPane.showTabSeparators boolean * @clientProperty JTabbedPane.showTabSeparators boolean
* @clientProperty JTabbedPane.hasFullBorder boolean * @clientProperty JTabbedPane.hasFullBorder boolean
* @clientProperty JTabbedPane.activeTabBorder boolean
* *
* <!-- BasicTabbedPaneUI --> * <!-- BasicTabbedPaneUI -->
* *
@@ -131,6 +130,7 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault TabbedPane.maximumTabWidth int optional * @uiDefault TabbedPane.maximumTabWidth int optional
* @uiDefault TabbedPane.tabHeight int * @uiDefault TabbedPane.tabHeight int
* @uiDefault TabbedPane.tabSelectionHeight int * @uiDefault TabbedPane.tabSelectionHeight int
* @uiDefault TabbedPane.cardTabSelectionHeight int
* @uiDefault TabbedPane.contentSeparatorHeight int * @uiDefault TabbedPane.contentSeparatorHeight int
* @uiDefault TabbedPane.showTabSeparators boolean * @uiDefault TabbedPane.showTabSeparators boolean
* @uiDefault TabbedPane.tabSeparatorsFullHeight boolean * @uiDefault TabbedPane.tabSeparatorsFullHeight boolean
@@ -138,6 +138,7 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault TabbedPane.activeTabBorder boolean * @uiDefault TabbedPane.activeTabBorder boolean
* *
* @uiDefault TabbedPane.tabLayoutPolicy String wrap (default) or scroll * @uiDefault TabbedPane.tabLayoutPolicy String wrap (default) or scroll
* @uiDefault TabbedPane.tabType String underlined (default) or card
* @uiDefault TabbedPane.tabsPopupPolicy String never or asNeeded (default) * @uiDefault TabbedPane.tabsPopupPolicy String never or asNeeded (default)
* @uiDefault TabbedPane.scrollButtonsPolicy String never, asNeeded or asNeededSingle (default) * @uiDefault TabbedPane.scrollButtonsPolicy String never, asNeeded or asNeededSingle (default)
* @uiDefault TabbedPane.scrollButtonsPlacement String both (default) or trailing * @uiDefault TabbedPane.scrollButtonsPlacement String both (default) or trailing
@@ -161,6 +162,10 @@ import com.formdev.flatlaf.util.UIScale;
public class FlatTabbedPaneUI public class FlatTabbedPaneUI
extends BasicTabbedPaneUI extends BasicTabbedPaneUI
{ {
// tab type
/** @since 2 */ protected static final int TAB_TYPE_UNDERLINED = 0;
/** @since 2 */ protected static final int TAB_TYPE_CARD = 1;
// tabs popup policy / scroll arrows policy // tabs popup policy / scroll arrows policy
protected static final int NEVER = 0; protected static final int NEVER = 0;
// protected static final int ALWAYS = 1; // protected static final int ALWAYS = 1;
@@ -196,13 +201,14 @@ public class FlatTabbedPaneUI
protected int maximumTabWidth; protected int maximumTabWidth;
protected int tabHeight; protected int tabHeight;
protected int tabSelectionHeight; protected int tabSelectionHeight;
/** @since 2 */ protected int cardTabSelectionHeight;
protected int contentSeparatorHeight; protected int contentSeparatorHeight;
protected boolean showTabSeparators; protected boolean showTabSeparators;
protected boolean tabSeparatorsFullHeight; protected boolean tabSeparatorsFullHeight;
protected boolean hasFullBorder; protected boolean hasFullBorder;
protected boolean tabsOpaque = true; protected boolean tabsOpaque = true;
protected boolean activeTabBorder;
private int tabType;
private int tabsPopupPolicy; private int tabsPopupPolicy;
private int scrollButtonsPolicy; private int scrollButtonsPolicy;
private int scrollButtonsPlacement; private int scrollButtonsPlacement;
@@ -304,13 +310,14 @@ public class FlatTabbedPaneUI
maximumTabWidth = UIManager.getInt( "TabbedPane.maximumTabWidth" ); maximumTabWidth = UIManager.getInt( "TabbedPane.maximumTabWidth" );
tabHeight = UIManager.getInt( "TabbedPane.tabHeight" ); tabHeight = UIManager.getInt( "TabbedPane.tabHeight" );
tabSelectionHeight = UIManager.getInt( "TabbedPane.tabSelectionHeight" ); tabSelectionHeight = UIManager.getInt( "TabbedPane.tabSelectionHeight" );
cardTabSelectionHeight = UIManager.getInt( "TabbedPane.cardTabSelectionHeight" );
contentSeparatorHeight = UIManager.getInt( "TabbedPane.contentSeparatorHeight" ); contentSeparatorHeight = UIManager.getInt( "TabbedPane.contentSeparatorHeight" );
showTabSeparators = UIManager.getBoolean( "TabbedPane.showTabSeparators" ); showTabSeparators = UIManager.getBoolean( "TabbedPane.showTabSeparators" );
tabSeparatorsFullHeight = UIManager.getBoolean( "TabbedPane.tabSeparatorsFullHeight" ); tabSeparatorsFullHeight = UIManager.getBoolean( "TabbedPane.tabSeparatorsFullHeight" );
hasFullBorder = UIManager.getBoolean( "TabbedPane.hasFullBorder" ); hasFullBorder = UIManager.getBoolean( "TabbedPane.hasFullBorder" );
tabsOpaque = UIManager.getBoolean( "TabbedPane.tabsOpaque" ); tabsOpaque = UIManager.getBoolean( "TabbedPane.tabsOpaque" );
activeTabBorder = UIManager.getBoolean( "TabbedPane.activeTabBorder" );
tabType = parseTabType( UIManager.getString( "TabbedPane.tabType" ) );
tabsPopupPolicy = parseTabsPopupPolicy( UIManager.getString( "TabbedPane.tabsPopupPolicy" ) ); tabsPopupPolicy = parseTabsPopupPolicy( UIManager.getString( "TabbedPane.tabsPopupPolicy" ) );
scrollButtonsPolicy = parseScrollButtonsPolicy( UIManager.getString( "TabbedPane.scrollButtonsPolicy" ) ); scrollButtonsPolicy = parseScrollButtonsPolicy( UIManager.getString( "TabbedPane.scrollButtonsPolicy" ) );
scrollButtonsPlacement = parseScrollButtonsPlacement( UIManager.getString( "TabbedPane.scrollButtonsPlacement" ) ); scrollButtonsPlacement = parseScrollButtonsPlacement( UIManager.getString( "TabbedPane.scrollButtonsPlacement" ) );
@@ -625,7 +632,7 @@ public class FlatTabbedPaneUI
// increase size of repaint region to include part of content border // increase size of repaint region to include part of content border
if( contentSeparatorHeight > 0 && if( contentSeparatorHeight > 0 &&
clientPropertyBoolean( tabPane, TABBED_PANE_ACTIVE_TAB_BORDER, activeTabBorder ) && getTabType() == TAB_TYPE_CARD &&
clientPropertyBoolean( tabPane, TABBED_PANE_SHOW_CONTENT_SEPARATOR, true ) ) clientPropertyBoolean( tabPane, TABBED_PANE_SHOW_CONTENT_SEPARATOR, true ) )
{ {
int sh = scale( contentSeparatorHeight ); int sh = scale( contentSeparatorHeight );
@@ -980,6 +987,7 @@ public class FlatTabbedPaneUI
g.fillRect( x, y, w, h ); g.fillRect( x, y, w, h );
} }
/** @since 2 */
protected Color getTabBackground( int tabPlacement, int tabIndex, boolean isSelected ) { protected Color getTabBackground( int tabPlacement, int tabIndex, boolean isSelected ) {
boolean enabled = tabPane.isEnabled(); boolean enabled = tabPane.isEnabled();
return enabled && tabPane.isEnabledAt( tabIndex ) && getRolloverTab() == tabIndex return enabled && tabPane.isEnabledAt( tabIndex ) && getRolloverTab() == tabIndex
@@ -999,8 +1007,8 @@ public class FlatTabbedPaneUI
if( clientPropertyBoolean( tabPane, TABBED_PANE_SHOW_TAB_SEPARATORS, showTabSeparators ) && if( clientPropertyBoolean( tabPane, TABBED_PANE_SHOW_TAB_SEPARATORS, showTabSeparators ) &&
!isLastInRun( tabIndex ) ) !isLastInRun( tabIndex ) )
{ {
if( clientPropertyBoolean( tabPane, TABBED_PANE_ACTIVE_TAB_BORDER, activeTabBorder ) ) { if( getTabType() == TAB_TYPE_CARD ) {
// Some separators need to be omitted when activeTabBorder is enabled // some separators need to be omitted if selected tab is painted as card
int selectedIndex = tabPane.getSelectedIndex(); int selectedIndex = tabPane.getSelectedIndex();
if( tabIndex != selectedIndex - 1 && tabIndex != selectedIndex ) if( tabIndex != selectedIndex - 1 && tabIndex != selectedIndex )
paintTabSeparator( g, tabPlacement, x, y, w, h ); paintTabSeparator( g, tabPlacement, x, y, w, h );
@@ -1009,11 +1017,12 @@ public class FlatTabbedPaneUI
} }
// paint active tab border // paint active tab border
if( isSelected && clientPropertyBoolean( tabPane, TABBED_PANE_ACTIVE_TAB_BORDER, activeTabBorder ) ) if( isSelected && getTabType() == TAB_TYPE_CARD )
paintSelectedTabBorder( g, tabPlacement, tabIndex, x, y, w, h ); paintCardTabBorder( g, tabPlacement, tabIndex, x, y, w, h );
} }
protected void paintSelectedTabBorder( Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h ) { /** @since 2 */
protected void paintCardTabBorder( Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h ) {
Graphics2D g2 = (Graphics2D) g; Graphics2D g2 = (Graphics2D) g;
float borderWidth = scale( (float) contentSeparatorHeight ); float borderWidth = scale( (float) contentSeparatorHeight );
@@ -1035,8 +1044,8 @@ public class FlatTabbedPaneUI
break; break;
} }
if( tabSelectionHeight <= 0 ) { if( cardTabSelectionHeight <= 0 ) {
//If there is no tab selection indicator, paint a top border as well // if there is no tab selection indicator, paint a top border as well
switch( tabPlacement ) { switch( tabPlacement ) {
default: default:
case TOP: case TOP:
@@ -1098,9 +1107,9 @@ public class FlatTabbedPaneUI
g.setColor( tabPane.isEnabled() ? underlineColor : disabledUnderlineColor ); g.setColor( tabPane.isEnabled() ? underlineColor : disabledUnderlineColor );
// paint underline selection // paint underline selection
boolean atBottom = !clientPropertyBoolean( tabPane, TABBED_PANE_ACTIVE_TAB_BORDER, activeTabBorder ); boolean atBottom = (getTabType() != TAB_TYPE_CARD);
Insets contentInsets = getContentBorderInsets( tabPlacement ); Insets contentInsets = getContentBorderInsets( tabPlacement );
int tabSelectionHeight = scale( this.tabSelectionHeight ); int tabSelectionHeight = scale( atBottom ? this.tabSelectionHeight : cardTabSelectionHeight );
int sx, sy; int sx, sy;
switch( tabPlacement ) { switch( tabPlacement ) {
case TOP: case TOP:
@@ -1189,7 +1198,7 @@ public class FlatTabbedPaneUI
w - (ci.left / 100f) - (ci.right / 100f), h - (ci.top / 100f) - (ci.bottom / 100f) ), false ); w - (ci.left / 100f) - (ci.right / 100f), h - (ci.top / 100f) - (ci.bottom / 100f) ), false );
// add gap for selected tab to path // add gap for selected tab to path
if( clientPropertyBoolean( tabPane, TABBED_PANE_ACTIVE_TAB_BORDER, activeTabBorder ) ) { if( getTabType() == TAB_TYPE_CARD ) {
float csh = scale( (float) contentSeparatorHeight ); float csh = scale( (float) contentSeparatorHeight );
Rectangle tabRect = getTabBounds( tabPane, selectedIndex ); Rectangle tabRect = getTabBounds( tabPane, selectedIndex );
@@ -1426,6 +1435,15 @@ public class FlatTabbedPaneUI
clientPropertyBoolean( tabPane, TABBED_PANE_HIDE_TAB_AREA_WITH_ONE_TAB, false ); clientPropertyBoolean( tabPane, TABBED_PANE_HIDE_TAB_AREA_WITH_ONE_TAB, false );
} }
/** @since 2 */
protected int getTabType() {
Object value = tabPane.getClientProperty( TABBED_PANE_TAB_TYPE );
return (value instanceof String)
? parseTabType( (String) value )
: tabType;
}
protected int getTabsPopupPolicy() { protected int getTabsPopupPolicy() {
Object value = tabPane.getClientProperty( TABBED_PANE_TABS_POPUP_POLICY ); Object value = tabPane.getClientProperty( TABBED_PANE_TABS_POPUP_POLICY );
@@ -1478,6 +1496,18 @@ public class FlatTabbedPaneUI
: tabWidthMode; : tabWidthMode;
} }
/** @since 2 */
protected static int parseTabType( String str ) {
if( str == null )
return TAB_TYPE_UNDERLINED;
switch( str ) {
default:
case TABBED_PANE_TAB_TYPE_UNDERLINED: return TAB_TYPE_UNDERLINED;
case TABBED_PANE_TAB_TYPE_CARD: return TAB_TYPE_CARD;
}
}
protected static int parseTabsPopupPolicy( String str ) { protected static int parseTabsPopupPolicy( String str ) {
if( str == null ) if( str == null )
return AS_NEEDED; return AS_NEEDED;
@@ -2445,7 +2475,7 @@ public class FlatTabbedPaneUI
break; break;
case TABBED_PANE_SHOW_TAB_SEPARATORS: case TABBED_PANE_SHOW_TAB_SEPARATORS:
case TABBED_PANE_ACTIVE_TAB_BORDER: case TABBED_PANE_TAB_TYPE:
tabPane.repaint(); tabPane.repaint();
break; break;

View File

@@ -569,9 +569,9 @@ SplitPaneDivider.gripGap = 2
TabbedPane.tabHeight = 32 TabbedPane.tabHeight = 32
TabbedPane.tabSelectionHeight = 3 TabbedPane.tabSelectionHeight = 3
TabbedPane.cardTabSelectionHeight = 2
TabbedPane.contentSeparatorHeight = 1 TabbedPane.contentSeparatorHeight = 1
TabbedPane.showTabSeparators = false TabbedPane.showTabSeparators = false
TabbedPane.activeTabBorder = false
TabbedPane.tabSeparatorsFullHeight = false TabbedPane.tabSeparatorsFullHeight = false
TabbedPane.hasFullBorder = false TabbedPane.hasFullBorder = false
TabbedPane.tabInsets = 4,12,4,12 TabbedPane.tabInsets = 4,12,4,12
@@ -591,6 +591,9 @@ TabbedPane.tabAlignment = center
# allowed values: preferred, equal or compact # allowed values: preferred, equal or compact
TabbedPane.tabWidthMode = preferred TabbedPane.tabWidthMode = preferred
# allowed values: underlined or card
TabbedPane.tabType = underlined
# allowed values: chevron or triangle # allowed values: chevron or triangle
TabbedPane.arrowType = chevron TabbedPane.arrowType = chevron
TabbedPane.buttonInsets = 2,1,2,1 TabbedPane.buttonInsets = 2,1,2,1

View File

@@ -303,17 +303,16 @@ class TabsPanel
putTabbedPanesClientProperty( TABBED_PANE_SCROLL_BUTTONS_PLACEMENT, scrollButtonsPlacement ); putTabbedPanesClientProperty( TABBED_PANE_SCROLL_BUTTONS_PLACEMENT, scrollButtonsPlacement );
} }
private void tabTypeChanged() {
String tabType = cardTabTypeButton.isSelected() ? TABBED_PANE_TAB_TYPE_CARD : null;
putTabbedPanesClientProperty( TABBED_PANE_TAB_TYPE, tabType );
}
private void showTabSeparatorsChanged() { private void showTabSeparatorsChanged() {
Boolean showTabSeparators = showTabSeparatorsCheckBox.isSelected() ? true : null; Boolean showTabSeparators = showTabSeparatorsCheckBox.isSelected() ? true : null;
putTabbedPanesClientProperty( TABBED_PANE_SHOW_TAB_SEPARATORS, showTabSeparators ); putTabbedPanesClientProperty( TABBED_PANE_SHOW_TAB_SEPARATORS, showTabSeparators );
} }
private void activeTabBorderChanged() {
Boolean activeBorderTab = activeTabBorderCheckBox.isSelected() ? true : false;
System.out.println(TABBED_PANE_ACTIVE_TAB_BORDER + ": " + activeBorderTab);
putTabbedPanesClientProperty( TABBED_PANE_ACTIVE_TAB_BORDER, activeBorderTab );
}
private void putTabbedPanesClientProperty( String key, Object value ) { private void putTabbedPanesClientProperty( String key, Object value ) {
updateTabbedPanesRecur( this, tabbedPane -> tabbedPane.putClientProperty( key, value ) ); updateTabbedPanesRecur( this, tabbedPane -> tabbedPane.putClientProperty( key, value ) );
} }
@@ -402,12 +401,15 @@ class TabsPanel
scrollButtonsPlacementToolBar = new JToolBar(); scrollButtonsPlacementToolBar = new JToolBar();
scrollBothButton = new JToggleButton(); scrollBothButton = new JToggleButton();
scrollTrailingButton = new JToggleButton(); scrollTrailingButton = new JToggleButton();
showTabSeparatorsCheckBox = new JCheckBox();
tabsPopupPolicyLabel = new JLabel(); tabsPopupPolicyLabel = new JLabel();
tabsPopupPolicyToolBar = new JToolBar(); tabsPopupPolicyToolBar = new JToolBar();
popupAsNeededButton = new JToggleButton(); popupAsNeededButton = new JToggleButton();
popupNeverButton = new JToggleButton(); popupNeverButton = new JToggleButton();
showTabSeparatorsCheckBox = new JCheckBox(); tabTypeLabel = new JLabel();
activeTabBorderCheckBox = new JCheckBox(); tabTypeToolBar = new JToolBar();
underlinedTabTypeButton = new JToggleButton();
cardTabTypeButton = new JToggleButton();
//======== this ======== //======== this ========
setName("this"); setName("this");
@@ -502,7 +504,7 @@ class TabsPanel
{ {
tabPlacementTabbedPane.setName("tabPlacementTabbedPane"); tabPlacementTabbedPane.setName("tabPlacementTabbedPane");
} }
panel1.add(tabPlacementTabbedPane, "cell 0 1, width 300:300, height 100:100"); panel1.add(tabPlacementTabbedPane, "cell 0 1,width 300:300,height 100:100");
//---- tabLayoutLabel ---- //---- tabLayoutLabel ----
tabLayoutLabel.setText("Tab layout"); tabLayoutLabel.setText("Tab layout");
@@ -880,7 +882,8 @@ class TabsPanel
"[]" + "[]" +
"[fill]para" + "[fill]para" +
"[fill]" + "[fill]" +
"[fill]para", "[fill]para" +
"[fill]",
// rows // rows
"[]" + "[]" +
"[center]")); "[center]"));
@@ -948,6 +951,12 @@ class TabsPanel
} }
panel4.add(scrollButtonsPlacementToolBar, "cell 3 0"); panel4.add(scrollButtonsPlacementToolBar, "cell 3 0");
//---- showTabSeparatorsCheckBox ----
showTabSeparatorsCheckBox.setText("Show tab separators");
showTabSeparatorsCheckBox.setName("showTabSeparatorsCheckBox");
showTabSeparatorsCheckBox.addActionListener(e -> showTabSeparatorsChanged());
panel4.add(showTabSeparatorsCheckBox, "cell 4 0");
//---- tabsPopupPolicyLabel ---- //---- tabsPopupPolicyLabel ----
tabsPopupPolicyLabel.setText("Tabs popup policy:"); tabsPopupPolicyLabel.setText("Tabs popup policy:");
tabsPopupPolicyLabel.setName("tabsPopupPolicyLabel"); tabsPopupPolicyLabel.setName("tabsPopupPolicyLabel");
@@ -976,17 +985,32 @@ class TabsPanel
} }
panel4.add(tabsPopupPolicyToolBar, "cell 1 1"); panel4.add(tabsPopupPolicyToolBar, "cell 1 1");
//---- showTabSeparatorsCheckBox ---- //---- tabTypeLabel ----
showTabSeparatorsCheckBox.setText("Show tab separators"); tabTypeLabel.setText("Tab type:");
showTabSeparatorsCheckBox.setName("showTabSeparatorsCheckBox"); tabTypeLabel.setName("tabTypeLabel");
showTabSeparatorsCheckBox.addActionListener(e -> showTabSeparatorsChanged()); panel4.add(tabTypeLabel, "cell 2 1");
panel4.add(showTabSeparatorsCheckBox, "cell 2 1");
//---- activeTabBorderCheckBox ---- //======== tabTypeToolBar ========
activeTabBorderCheckBox.setText("Paint border around active tab"); {
activeTabBorderCheckBox.setName("activeTabBorderCheckBox"); tabTypeToolBar.setFloatable(false);
activeTabBorderCheckBox.addActionListener(e -> activeTabBorderChanged()); tabTypeToolBar.setName("tabTypeToolBar");
panel4.add(activeTabBorderCheckBox, "cell 3 1");
//---- underlinedTabTypeButton ----
underlinedTabTypeButton.setText("underlined");
underlinedTabTypeButton.setFont(underlinedTabTypeButton.getFont().deriveFont(underlinedTabTypeButton.getFont().getSize() - 2f));
underlinedTabTypeButton.setSelected(true);
underlinedTabTypeButton.setName("underlinedTabTypeButton");
underlinedTabTypeButton.addActionListener(e -> tabTypeChanged());
tabTypeToolBar.add(underlinedTabTypeButton);
//---- cardTabTypeButton ----
cardTabTypeButton.setText("card");
cardTabTypeButton.setFont(cardTabTypeButton.getFont().deriveFont(cardTabTypeButton.getFont().getSize() - 2f));
cardTabTypeButton.setName("cardTabTypeButton");
cardTabTypeButton.addActionListener(e -> tabTypeChanged());
tabTypeToolBar.add(cardTabTypeButton);
}
panel4.add(tabTypeToolBar, "cell 3 1");
} }
add(panel4, "cell 0 2 3 1"); add(panel4, "cell 0 2 3 1");
@@ -1023,6 +1047,11 @@ class TabsPanel
ButtonGroup tabsPopupPolicyButtonGroup = new ButtonGroup(); ButtonGroup tabsPopupPolicyButtonGroup = new ButtonGroup();
tabsPopupPolicyButtonGroup.add(popupAsNeededButton); tabsPopupPolicyButtonGroup.add(popupAsNeededButton);
tabsPopupPolicyButtonGroup.add(popupNeverButton); tabsPopupPolicyButtonGroup.add(popupNeverButton);
//---- tabTypeButtonGroup ----
ButtonGroup tabTypeButtonGroup = new ButtonGroup();
tabTypeButtonGroup.add(underlinedTabTypeButton);
tabTypeButtonGroup.add(cardTabTypeButton);
// JFormDesigner - End of component initialization //GEN-END:initComponents // JFormDesigner - End of component initialization //GEN-END:initComponents
if( FlatLafDemo.screenshotsMode ) { if( FlatLafDemo.screenshotsMode ) {
@@ -1102,11 +1131,14 @@ class TabsPanel
private JToolBar scrollButtonsPlacementToolBar; private JToolBar scrollButtonsPlacementToolBar;
private JToggleButton scrollBothButton; private JToggleButton scrollBothButton;
private JToggleButton scrollTrailingButton; private JToggleButton scrollTrailingButton;
private JCheckBox showTabSeparatorsCheckBox;
private JLabel tabsPopupPolicyLabel; private JLabel tabsPopupPolicyLabel;
private JToolBar tabsPopupPolicyToolBar; private JToolBar tabsPopupPolicyToolBar;
private JToggleButton popupAsNeededButton; private JToggleButton popupAsNeededButton;
private JToggleButton popupNeverButton; private JToggleButton popupNeverButton;
private JCheckBox showTabSeparatorsCheckBox; private JLabel tabTypeLabel;
private JCheckBox activeTabBorderCheckBox; private JToolBar tabTypeToolBar;
private JToggleButton underlinedTabTypeButton;
private JToggleButton cardTabTypeButton;
// JFormDesigner - End of variables declaration //GEN-END:variables // JFormDesigner - End of variables declaration //GEN-END:variables
} }

View File

@@ -457,7 +457,7 @@ new FormModel {
} ) } )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 0,hidemode 3" "$layoutConstraints": "insets 0,hidemode 3"
"$columnConstraints": "[][fill]para[fill][fill]para" "$columnConstraints": "[][fill]para[fill][fill]para[fill]"
"$rowConstraints": "[][center]" "$rowConstraints": "[][center]"
} ) { } ) {
name: "panel4" name: "panel4"
@@ -527,6 +527,16 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 0" "value": "cell 3 0"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "showTabSeparatorsCheckBox"
"text": "Show tab separators"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showTabSeparatorsChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 0"
} )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "tabsPopupPolicyLabel" name: "tabsPopupPolicyLabel"
"text": "Tabs popup policy:" "text": "Tabs popup policy:"
@@ -555,15 +565,32 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 1" "value": "cell 1 1"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "showTabSeparatorsCheckBox" name: "tabTypeLabel"
"text": "Show tab separators" "text": "Tab type:"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showTabSeparatorsChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 1 2 1" "value": "cell 2 1"
} )
add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) {
name: "tabTypeToolBar"
"floatable": false
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "underlinedTabTypeButton"
"text": "underlined"
"font": &SwingDerivedFont8 new com.jformdesigner.model.SwingDerivedFont( null, 0, -2, false )
"selected": true
"$buttonGroup": new FormReference( "tabTypeButtonGroup" )
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabTypeChanged", false ) )
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "cardTabTypeButton"
"text": "card"
"font": #SwingDerivedFont8
"$buttonGroup": new FormReference( "tabTypeButtonGroup" )
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabTypeChanged", false ) )
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 1"
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2 3 1" "value": "cell 0 2 3 1"
@@ -602,5 +629,10 @@ new FormModel {
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 200, 1020 ) "location": new java.awt.Point( 200, 1020 )
} ) } )
add( new FormNonVisual( "javax.swing.ButtonGroup" ) {
name: "tabTypeButtonGroup"
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 1072 )
} )
} }
} }

View File

@@ -363,6 +363,29 @@ public class FlatTabbedPane
} }
// NOTE: enum names must be equal to allowed strings
/** @since 2 */ public enum TabType { underlined, card };
/**
* Returns type of selected tab.
*
* @since 2
*/
public TabType getTabType() {
return getClientPropertyEnumString( TABBED_PANE_TAB_TYPE, TabType.class,
"TabbedPane.tabType", TabType.underlined );
}
/**
* Specifies type of selected tab.
*
* @since 2
*/
public void setTabType( TabType tabType ) {
putClientPropertyEnumString( TABBED_PANE_TAB_TYPE, tabType );
}
// NOTE: enum names must be equal to allowed strings // NOTE: enum names must be equal to allowed strings
public enum TabsPopupPolicy { never, asNeeded }; public enum TabsPopupPolicy { never, asNeeded };

View File

@@ -980,6 +980,7 @@ TabbedPane.buttonArc 6
TabbedPane.buttonHoverBackground #303234 com.formdev.flatlaf.util.DerivedColor [UI] darken(5%) TabbedPane.buttonHoverBackground #303234 com.formdev.flatlaf.util.DerivedColor [UI] darken(5%)
TabbedPane.buttonInsets 2,1,2,1 javax.swing.plaf.InsetsUIResource [UI] TabbedPane.buttonInsets 2,1,2,1 javax.swing.plaf.InsetsUIResource [UI]
TabbedPane.buttonPressedBackground #282a2c com.formdev.flatlaf.util.DerivedColor [UI] darken(8%) TabbedPane.buttonPressedBackground #282a2c com.formdev.flatlaf.util.DerivedColor [UI] darken(8%)
TabbedPane.cardTabSelectionHeight 2
TabbedPane.closeArc 4 TabbedPane.closeArc 4
TabbedPane.closeCrossFilledSize 7.5 TabbedPane.closeCrossFilledSize 7.5
TabbedPane.closeCrossLineWidth 1.0 TabbedPane.closeCrossLineWidth 1.0
@@ -1022,6 +1023,7 @@ TabbedPane.tabInsets 4,12,4,12 javax.swing.plaf.InsetsUIResource [U
TabbedPane.tabRunOverlay 0 TabbedPane.tabRunOverlay 0
TabbedPane.tabSelectionHeight 3 TabbedPane.tabSelectionHeight 3
TabbedPane.tabSeparatorsFullHeight false TabbedPane.tabSeparatorsFullHeight false
TabbedPane.tabType underlined
TabbedPane.tabWidthMode preferred TabbedPane.tabWidthMode preferred
TabbedPane.tabsOpaque true TabbedPane.tabsOpaque true
TabbedPane.tabsOverlapBorder false TabbedPane.tabsOverlapBorder false

View File

@@ -985,6 +985,7 @@ TabbedPane.buttonArc 6
TabbedPane.buttonHoverBackground #e0e0e0 com.formdev.flatlaf.util.DerivedColor [UI] darken(7% autoInverse) TabbedPane.buttonHoverBackground #e0e0e0 com.formdev.flatlaf.util.DerivedColor [UI] darken(7% autoInverse)
TabbedPane.buttonInsets 2,1,2,1 javax.swing.plaf.InsetsUIResource [UI] TabbedPane.buttonInsets 2,1,2,1 javax.swing.plaf.InsetsUIResource [UI]
TabbedPane.buttonPressedBackground #d9d9d9 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse) TabbedPane.buttonPressedBackground #d9d9d9 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse)
TabbedPane.cardTabSelectionHeight 2
TabbedPane.closeArc 4 TabbedPane.closeArc 4
TabbedPane.closeCrossFilledSize 7.5 TabbedPane.closeCrossFilledSize 7.5
TabbedPane.closeCrossLineWidth 1.0 TabbedPane.closeCrossLineWidth 1.0
@@ -1027,6 +1028,7 @@ TabbedPane.tabInsets 4,12,4,12 javax.swing.plaf.InsetsUIResource [U
TabbedPane.tabRunOverlay 0 TabbedPane.tabRunOverlay 0
TabbedPane.tabSelectionHeight 3 TabbedPane.tabSelectionHeight 3
TabbedPane.tabSeparatorsFullHeight false TabbedPane.tabSeparatorsFullHeight false
TabbedPane.tabType underlined
TabbedPane.tabWidthMode preferred TabbedPane.tabWidthMode preferred
TabbedPane.tabsOpaque true TabbedPane.tabsOpaque true
TabbedPane.tabsOverlapBorder false TabbedPane.tabsOverlapBorder false

View File

@@ -980,6 +980,7 @@ TabbedPane.buttonArc 6
TabbedPane.buttonHoverBackground #ffff00 javax.swing.plaf.ColorUIResource [UI] TabbedPane.buttonHoverBackground #ffff00 javax.swing.plaf.ColorUIResource [UI]
TabbedPane.buttonInsets 2,1,2,1 javax.swing.plaf.InsetsUIResource [UI] TabbedPane.buttonInsets 2,1,2,1 javax.swing.plaf.InsetsUIResource [UI]
TabbedPane.buttonPressedBackground #ffc800 javax.swing.plaf.ColorUIResource [UI] TabbedPane.buttonPressedBackground #ffc800 javax.swing.plaf.ColorUIResource [UI]
TabbedPane.cardTabSelectionHeight 2
TabbedPane.closeArc 999 TabbedPane.closeArc 999
TabbedPane.closeCrossFilledSize 6.5 TabbedPane.closeCrossFilledSize 6.5
TabbedPane.closeCrossLineWidth 2.0 TabbedPane.closeCrossLineWidth 2.0
@@ -1025,6 +1026,7 @@ TabbedPane.tabRunOverlay 0
TabbedPane.tabSelectionHeight 3 TabbedPane.tabSelectionHeight 3
TabbedPane.tabSeparatorColor #0000ff javax.swing.plaf.ColorUIResource [UI] TabbedPane.tabSeparatorColor #0000ff javax.swing.plaf.ColorUIResource [UI]
TabbedPane.tabSeparatorsFullHeight false TabbedPane.tabSeparatorsFullHeight false
TabbedPane.tabType underlined
TabbedPane.tabWidthMode preferred TabbedPane.tabWidthMode preferred
TabbedPane.tabsOpaque true TabbedPane.tabsOpaque true
TabbedPane.tabsOverlapBorder false TabbedPane.tabsOverlapBorder false

View File

@@ -50,6 +50,8 @@ public class FlatContainerTest
public FlatContainerTest() { public FlatContainerTest() {
initComponents(); initComponents();
tabTypeComboBox.init( TabType.class, true );
tabPlacementField.init( TabPlacement.class, true ); tabPlacementField.init( TabPlacement.class, true );
iconPlacementField.init( TabIconPlacement.class, true ); iconPlacementField.init( TabIconPlacement.class, true );
tabsPopupPolicyField.init( TabsPopupPolicy.class, true ); tabsPopupPolicyField.init( TabsPopupPolicy.class, true );
@@ -310,6 +312,12 @@ public class FlatContainerTest
tabbedPane.setTabWidthMode( value ); tabbedPane.setTabWidthMode( value );
} }
private void tabTypeChanged() {
TabType value = tabTypeComboBox.getSelectedValue();
for( FlatTabbedPane tabbedPane : allTabbedPanes )
tabbedPane.setTabType( value );
}
private void tabBackForegroundChanged() { private void tabBackForegroundChanged() {
for( JTabbedPane tabbedPane : allTabbedPanes ) for( JTabbedPane tabbedPane : allTabbedPanes )
tabBackForegroundChanged( tabbedPane ); tabBackForegroundChanged( tabbedPane );
@@ -491,6 +499,8 @@ public class FlatContainerTest
tabAlignmentField = new FlatTestEnumComboBox<>(); tabAlignmentField = new FlatTestEnumComboBox<>();
JLabel tabWidthModeLabel = new JLabel(); JLabel tabWidthModeLabel = new JLabel();
tabWidthModeField = new FlatTestEnumComboBox<>(); tabWidthModeField = new FlatTestEnumComboBox<>();
JLabel tabTypeLabel = new JLabel();
tabTypeComboBox = new FlatTestEnumComboBox<>();
leadingComponentCheckBox = new JCheckBox(); leadingComponentCheckBox = new JCheckBox();
customBorderCheckBox = new JCheckBox(); customBorderCheckBox = new JCheckBox();
tabAreaInsetsCheckBox = new JCheckBox(); tabAreaInsetsCheckBox = new JCheckBox();
@@ -619,6 +629,7 @@ public class FlatContainerTest
"[]" + "[]" +
"[]" + "[]" +
"[]" + "[]" +
"[]" +
"[]para" + "[]para" +
"[]" + "[]" +
"[]para" + "[]para" +
@@ -739,75 +750,83 @@ public class FlatContainerTest
tabWidthModeField.addActionListener(e -> tabWidthModeChanged()); tabWidthModeField.addActionListener(e -> tabWidthModeChanged());
tabbedPaneControlPanel.add(tabWidthModeField, "cell 2 5"); tabbedPaneControlPanel.add(tabWidthModeField, "cell 2 5");
//---- tabTypeLabel ----
tabTypeLabel.setText("Tab type:");
tabbedPaneControlPanel.add(tabTypeLabel, "cell 0 6");
//---- tabTypeComboBox ----
tabTypeComboBox.addActionListener(e -> tabTypeChanged());
tabbedPaneControlPanel.add(tabTypeComboBox, "cell 1 6");
//---- leadingComponentCheckBox ---- //---- leadingComponentCheckBox ----
leadingComponentCheckBox.setText("Leading component"); leadingComponentCheckBox.setText("Leading component");
leadingComponentCheckBox.addActionListener(e -> leadingComponentChanged()); leadingComponentCheckBox.addActionListener(e -> leadingComponentChanged());
tabbedPaneControlPanel.add(leadingComponentCheckBox, "cell 0 6"); tabbedPaneControlPanel.add(leadingComponentCheckBox, "cell 0 7");
//---- customBorderCheckBox ---- //---- customBorderCheckBox ----
customBorderCheckBox.setText("Custom border"); customBorderCheckBox.setText("Custom border");
customBorderCheckBox.addActionListener(e -> customBorderChanged()); customBorderCheckBox.addActionListener(e -> customBorderChanged());
tabbedPaneControlPanel.add(customBorderCheckBox, "cell 1 6"); tabbedPaneControlPanel.add(customBorderCheckBox, "cell 1 7");
//---- tabAreaInsetsCheckBox ---- //---- tabAreaInsetsCheckBox ----
tabAreaInsetsCheckBox.setText("Tab area insets (5,5,10,10)"); tabAreaInsetsCheckBox.setText("Tab area insets (5,5,10,10)");
tabAreaInsetsCheckBox.addActionListener(e -> tabAreaInsetsChanged()); tabAreaInsetsCheckBox.addActionListener(e -> tabAreaInsetsChanged());
tabbedPaneControlPanel.add(tabAreaInsetsCheckBox, "cell 2 6"); tabbedPaneControlPanel.add(tabAreaInsetsCheckBox, "cell 2 7");
//---- trailingComponentCheckBox ---- //---- trailingComponentCheckBox ----
trailingComponentCheckBox.setText("Trailing component"); trailingComponentCheckBox.setText("Trailing component");
trailingComponentCheckBox.addActionListener(e -> trailingComponentChanged()); trailingComponentCheckBox.addActionListener(e -> trailingComponentChanged());
tabbedPaneControlPanel.add(trailingComponentCheckBox, "cell 0 7"); tabbedPaneControlPanel.add(trailingComponentCheckBox, "cell 0 8");
//---- hasFullBorderCheckBox ---- //---- hasFullBorderCheckBox ----
hasFullBorderCheckBox.setText("Show content border"); hasFullBorderCheckBox.setText("Show content border");
hasFullBorderCheckBox.addActionListener(e -> hasFullBorderChanged()); hasFullBorderCheckBox.addActionListener(e -> hasFullBorderChanged());
tabbedPaneControlPanel.add(hasFullBorderCheckBox, "cell 1 7,alignx left,growx 0"); tabbedPaneControlPanel.add(hasFullBorderCheckBox, "cell 1 8,alignx left,growx 0");
//---- smallerTabHeightCheckBox ---- //---- smallerTabHeightCheckBox ----
smallerTabHeightCheckBox.setText("Smaller tab height (26)"); smallerTabHeightCheckBox.setText("Smaller tab height (26)");
smallerTabHeightCheckBox.addActionListener(e -> smallerTabHeightChanged()); smallerTabHeightCheckBox.addActionListener(e -> smallerTabHeightChanged());
tabbedPaneControlPanel.add(smallerTabHeightCheckBox, "cell 2 7"); tabbedPaneControlPanel.add(smallerTabHeightCheckBox, "cell 2 8");
//---- minimumTabWidthCheckBox ---- //---- minimumTabWidthCheckBox ----
minimumTabWidthCheckBox.setText("Minimum tab width (100)"); minimumTabWidthCheckBox.setText("Minimum tab width (100)");
minimumTabWidthCheckBox.addActionListener(e -> minimumTabWidthChanged()); minimumTabWidthCheckBox.addActionListener(e -> minimumTabWidthChanged());
tabbedPaneControlPanel.add(minimumTabWidthCheckBox, "cell 0 8"); tabbedPaneControlPanel.add(minimumTabWidthCheckBox, "cell 0 9");
//---- hideContentSeparatorCheckBox ---- //---- hideContentSeparatorCheckBox ----
hideContentSeparatorCheckBox.setText("Hide content separator"); hideContentSeparatorCheckBox.setText("Hide content separator");
hideContentSeparatorCheckBox.addActionListener(e -> hideContentSeparatorChanged()); hideContentSeparatorCheckBox.addActionListener(e -> hideContentSeparatorChanged());
tabbedPaneControlPanel.add(hideContentSeparatorCheckBox, "cell 1 8"); tabbedPaneControlPanel.add(hideContentSeparatorCheckBox, "cell 1 9");
//---- smallerInsetsCheckBox ---- //---- smallerInsetsCheckBox ----
smallerInsetsCheckBox.setText("Smaller tab insets (2,2,2,2)"); smallerInsetsCheckBox.setText("Smaller tab insets (2,2,2,2)");
smallerInsetsCheckBox.addActionListener(e -> smallerInsetsChanged()); smallerInsetsCheckBox.addActionListener(e -> smallerInsetsChanged());
tabbedPaneControlPanel.add(smallerInsetsCheckBox, "cell 2 8"); tabbedPaneControlPanel.add(smallerInsetsCheckBox, "cell 2 9");
//---- maximumTabWidthCheckBox ---- //---- maximumTabWidthCheckBox ----
maximumTabWidthCheckBox.setText("Maximum tab width (60)"); maximumTabWidthCheckBox.setText("Maximum tab width (60)");
maximumTabWidthCheckBox.addActionListener(e -> maximumTabWidthChanged()); maximumTabWidthCheckBox.addActionListener(e -> maximumTabWidthChanged());
tabbedPaneControlPanel.add(maximumTabWidthCheckBox, "cell 0 9"); tabbedPaneControlPanel.add(maximumTabWidthCheckBox, "cell 0 10");
//---- showTabSeparatorsCheckBox ---- //---- showTabSeparatorsCheckBox ----
showTabSeparatorsCheckBox.setText("Show tab separators"); showTabSeparatorsCheckBox.setText("Show tab separators");
showTabSeparatorsCheckBox.addActionListener(e -> showTabSeparatorsChanged()); showTabSeparatorsCheckBox.addActionListener(e -> showTabSeparatorsChanged());
tabbedPaneControlPanel.add(showTabSeparatorsCheckBox, "cell 1 9"); tabbedPaneControlPanel.add(showTabSeparatorsCheckBox, "cell 1 10");
//---- secondTabWiderCheckBox ---- //---- secondTabWiderCheckBox ----
secondTabWiderCheckBox.setText("Second Tab insets wider (4,20,4,20)"); secondTabWiderCheckBox.setText("Second Tab insets wider (4,20,4,20)");
secondTabWiderCheckBox.addActionListener(e -> secondTabWiderChanged()); secondTabWiderCheckBox.addActionListener(e -> secondTabWiderChanged());
tabbedPaneControlPanel.add(secondTabWiderCheckBox, "cell 2 9"); tabbedPaneControlPanel.add(secondTabWiderCheckBox, "cell 2 10");
//---- hideTabAreaWithOneTabCheckBox ---- //---- hideTabAreaWithOneTabCheckBox ----
hideTabAreaWithOneTabCheckBox.setText("Hide tab area with one tab"); hideTabAreaWithOneTabCheckBox.setText("Hide tab area with one tab");
hideTabAreaWithOneTabCheckBox.addActionListener(e -> hideTabAreaWithOneTabChanged()); hideTabAreaWithOneTabCheckBox.addActionListener(e -> hideTabAreaWithOneTabChanged());
tabbedPaneControlPanel.add(hideTabAreaWithOneTabCheckBox, "cell 1 10"); tabbedPaneControlPanel.add(hideTabAreaWithOneTabCheckBox, "cell 1 11");
//---- customWheelScrollingCheckBox ---- //---- customWheelScrollingCheckBox ----
customWheelScrollingCheckBox.setText("Custom wheel scrolling"); customWheelScrollingCheckBox.setText("Custom wheel scrolling");
customWheelScrollingCheckBox.addActionListener(e -> customWheelScrollingChanged()); customWheelScrollingCheckBox.addActionListener(e -> customWheelScrollingChanged());
tabbedPaneControlPanel.add(customWheelScrollingCheckBox, "cell 2 10"); tabbedPaneControlPanel.add(customWheelScrollingCheckBox, "cell 2 11");
} }
panel9.add(tabbedPaneControlPanel, cc.xywh(1, 11, 3, 1)); panel9.add(tabbedPaneControlPanel, cc.xywh(1, 11, 3, 1));
} }
@@ -840,6 +859,7 @@ public class FlatContainerTest
private FlatTestEnumComboBox<TabAreaAlignment> tabAreaAlignmentField; private FlatTestEnumComboBox<TabAreaAlignment> tabAreaAlignmentField;
private FlatTestEnumComboBox<TabAlignment> tabAlignmentField; private FlatTestEnumComboBox<TabAlignment> tabAlignmentField;
private FlatTestEnumComboBox<TabWidthMode> tabWidthModeField; private FlatTestEnumComboBox<TabWidthMode> tabWidthModeField;
private FlatTestEnumComboBox<TabType> tabTypeComboBox;
private JCheckBox leadingComponentCheckBox; private JCheckBox leadingComponentCheckBox;
private JCheckBox customBorderCheckBox; private JCheckBox customBorderCheckBox;
private JCheckBox tabAreaInsetsCheckBox; private JCheckBox tabAreaInsetsCheckBox;

View File

@@ -132,7 +132,7 @@ new FormModel {
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestFrame$NoRightToLeftPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestFrame$NoRightToLeftPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 0,hidemode 3" "$layoutConstraints": "insets 0,hidemode 3"
"$columnConstraints": "[][fill][]" "$columnConstraints": "[][fill][]"
"$rowConstraints": "[center][][][][][]para[][]para[][][]" "$rowConstraints": "[center][][][][][][]para[][]para[][][]"
} ) { } ) {
name: "tabbedPaneControlPanel" name: "tabbedPaneControlPanel"
"opaque": false "opaque": false
@@ -372,6 +372,22 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 5" "value": "cell 2 5"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "tabTypeLabel"
"text": "Tab type:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 6"
} )
add( new FormComponent( "com.formdev.flatlaf.testing.FlatTestEnumComboBox" ) {
name: "tabTypeComboBox"
auxiliary() {
"JavaCodeGenerator.typeParameters": "TabType"
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabTypeChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 6"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "leadingComponentCheckBox" name: "leadingComponentCheckBox"
"text": "Leading component" "text": "Leading component"
@@ -380,7 +396,7 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "leadingComponentChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "leadingComponentChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 6" "value": "cell 0 7"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "customBorderCheckBox" name: "customBorderCheckBox"
@@ -390,7 +406,7 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "customBorderChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "customBorderChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 6" "value": "cell 1 7"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "tabAreaInsetsCheckBox" name: "tabAreaInsetsCheckBox"
@@ -400,7 +416,7 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabAreaInsetsChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabAreaInsetsChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 6" "value": "cell 2 7"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "trailingComponentCheckBox" name: "trailingComponentCheckBox"
@@ -410,7 +426,7 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "trailingComponentChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "trailingComponentChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 7" "value": "cell 0 8"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "hasFullBorderCheckBox" name: "hasFullBorderCheckBox"
@@ -420,7 +436,7 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hasFullBorderChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hasFullBorderChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 7,alignx left,growx 0" "value": "cell 1 8,alignx left,growx 0"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "smallerTabHeightCheckBox" name: "smallerTabHeightCheckBox"
@@ -430,7 +446,7 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "smallerTabHeightChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "smallerTabHeightChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 7" "value": "cell 2 8"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "minimumTabWidthCheckBox" name: "minimumTabWidthCheckBox"
@@ -440,7 +456,7 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "minimumTabWidthChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "minimumTabWidthChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 8" "value": "cell 0 9"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "hideContentSeparatorCheckBox" name: "hideContentSeparatorCheckBox"
@@ -450,7 +466,7 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hideContentSeparatorChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hideContentSeparatorChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 8" "value": "cell 1 9"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "smallerInsetsCheckBox" name: "smallerInsetsCheckBox"
@@ -460,7 +476,7 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "smallerInsetsChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "smallerInsetsChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 8" "value": "cell 2 9"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "maximumTabWidthCheckBox" name: "maximumTabWidthCheckBox"
@@ -470,7 +486,7 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "maximumTabWidthChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "maximumTabWidthChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 9" "value": "cell 0 10"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "showTabSeparatorsCheckBox" name: "showTabSeparatorsCheckBox"
@@ -480,7 +496,7 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showTabSeparatorsChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showTabSeparatorsChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 9" "value": "cell 1 10"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "secondTabWiderCheckBox" name: "secondTabWiderCheckBox"
@@ -490,7 +506,7 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "secondTabWiderChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "secondTabWiderChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 9" "value": "cell 2 10"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "hideTabAreaWithOneTabCheckBox" name: "hideTabAreaWithOneTabCheckBox"
@@ -500,7 +516,7 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hideTabAreaWithOneTabChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hideTabAreaWithOneTabChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 10" "value": "cell 1 11"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "customWheelScrollingCheckBox" name: "customWheelScrollingCheckBox"
@@ -510,7 +526,7 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "customWheelScrollingChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "customWheelScrollingChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 10" "value": "cell 2 11"
} ) } )
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) { }, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
"gridY": 11 "gridY": 11

View File

@@ -709,6 +709,7 @@ TabbedPane.buttonArc
TabbedPane.buttonHoverBackground TabbedPane.buttonHoverBackground
TabbedPane.buttonInsets TabbedPane.buttonInsets
TabbedPane.buttonPressedBackground TabbedPane.buttonPressedBackground
TabbedPane.cardTabSelectionHeight
TabbedPane.closeArc TabbedPane.closeArc
TabbedPane.closeCrossFilledSize TabbedPane.closeCrossFilledSize
TabbedPane.closeCrossLineWidth TabbedPane.closeCrossLineWidth
@@ -754,6 +755,7 @@ TabbedPane.tabInsets
TabbedPane.tabRunOverlay TabbedPane.tabRunOverlay
TabbedPane.tabSelectionHeight TabbedPane.tabSelectionHeight
TabbedPane.tabSeparatorsFullHeight TabbedPane.tabSeparatorsFullHeight
TabbedPane.tabType
TabbedPane.tabWidthMode TabbedPane.tabWidthMode
TabbedPane.tabsOpaque TabbedPane.tabsOpaque
TabbedPane.tabsOverlapBorder TabbedPane.tabsOverlapBorder