TabbedPane:

- support forward/backward scroll buttons on both sides of the tab area (new default)
- optionally: not applicable scroll buttons are hidden (new default)
- changed configuration
  - removed TabbedPane.hiddenTabsNavigation
  - added TabbedPane.tabsPopupPolicy, TabbedPane.scrollButtonsPolicy and TabbedPane.scrollButtonsPlacement
- made scroll arrows larger

(issue #40; replaces PR #195)
This commit is contained in:
Karl Tauber
2020-11-13 17:34:46 +01:00
parent cbc1fe27ef
commit c16c3759cf
5 changed files with 537 additions and 260 deletions

View File

@@ -366,28 +366,85 @@ public interface FlatClientProperties
String TABBED_PANE_TAB_CLOSE_CALLBACK = "JTabbedPane.tabCloseCallback"; String TABBED_PANE_TAB_CLOSE_CALLBACK = "JTabbedPane.tabCloseCallback";
/** /**
* Specifies how to navigate to hidden tabs. * Specifies the display policy for the "more tabs" button,
* which shows a popup menu with the (partly) hidden tabs.
* <p> * <p>
* <strong>Component</strong> {@link javax.swing.JTabbedPane}<br> * <strong>Component</strong> {@link javax.swing.JTabbedPane}<br>
* <strong>Value type</strong> {@link java.lang.String}<br> * <strong>Value type</strong> {@link java.lang.String}<br>
* <strong>Allowed Values</strong> {@link #TABBED_PANE_HIDDEN_TABS_NAVIGATION_MORE_TABS_BUTTON} * <strong>Allowed Values</strong>
* or {@link #TABBED_PANE_HIDDEN_TABS_NAVIGATION_ARROW_BUTTONS} * {@link #TABBED_PANE_POLICY_NEVER} or
* {@link #TABBED_PANE_POLICY_AS_NEEDED}
*/ */
String TABBED_PANE_HIDDEN_TABS_NAVIGATION = "JTabbedPane.hiddenTabsNavigation"; String TABBED_PANE_TABS_POPUP_POLICY = "JTabbedPane.tabsPopupPolicy";
/** /**
* Use "more tabs" button for navigation to hidden tabs. * Specifies the display policy for the forward/backward scroll arrow buttons.
* * <p>
* @see #TABBED_PANE_HIDDEN_TABS_NAVIGATION * <strong>Component</strong> {@link javax.swing.JTabbedPane}<br>
* <strong>Value type</strong> {@link java.lang.String}<br>
* <strong>Allowed Values</strong>
* {@link #TABBED_PANE_POLICY_NEVER},
* {@link #TABBED_PANE_POLICY_AS_NEEDED} or
* {@link #TABBED_PANE_POLICY_AS_NEEDED_SINGLE}
*/ */
String TABBED_PANE_HIDDEN_TABS_NAVIGATION_MORE_TABS_BUTTON = "moreTabsButton"; String TABBED_PANE_SCROLL_BUTTONS_POLICY = "JTabbedPane.scrollButtondPolicy";
/** /**
* Use forward/backward buttons for navigation to hidden tabs. * Display never.
* *
* @see #TABBED_PANE_HIDDEN_TABS_NAVIGATION * @see #TABBED_PANE_TABS_POPUP_POLICY
* @see #TABBED_PANE_SCROLL_BUTTONS_POLICY
*/ */
String TABBED_PANE_HIDDEN_TABS_NAVIGATION_ARROW_BUTTONS = "arrowButtons"; String TABBED_PANE_POLICY_NEVER = "never";
/**
* Display only when needed.
* <p>
* If used for {@link #TABBED_PANE_SCROLL_BUTTONS_POLICY}, both scroll arrow buttons
* are either shown or hidden. Buttons are disabled if scrolling in that
* direction is not applicable.
*
* @see #TABBED_PANE_TABS_POPUP_POLICY
* @see #TABBED_PANE_SCROLL_BUTTONS_POLICY
*/
String TABBED_PANE_POLICY_AS_NEEDED = "asNeeded";
/**
* Display single button only when needed.
* <p>
* If scroll button placement is trailing, then this option is ignored
* and both buttons are shown or hidden as needed.
*
* @see #TABBED_PANE_SCROLL_BUTTONS_POLICY
*/
String TABBED_PANE_POLICY_AS_NEEDED_SINGLE = "asNeededSingle";
/**
* Specifies the placement of the forward/backward scroll arrow buttons.
* <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_PLACEMENT_BOTH} or
* {@link #TABBED_PANE_PLACEMENT_TRAILING}
*/
String TABBED_PANE_SCROLL_BUTTONS_PLACEMENT = "JTabbedPane.scrollButtonsPlacement";
/**
* The forward/backward scroll arrow buttons are placed on both sides of the tab area.
* The backward scroll button at the left/top side.
* The forward scroll button at the right/bottom side.
*
* @see #TABBED_PANE_SCROLL_BUTTONS_PLACEMENT
*/
String TABBED_PANE_PLACEMENT_BOTH = "both";
/**
* The forward/backward scroll arrow buttons are placed on the trailing side of the tab area.
*
* @see #TABBED_PANE_SCROLL_BUTTONS_PLACEMENT
*/
String TABBED_PANE_PLACEMENT_TRAILING = "trailing";
/** /**
* Specifies the alignment of the tab area. * Specifies the alignment of the tab area.

View File

@@ -130,7 +130,11 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault TabbedPane.showTabSeparators boolean * @uiDefault TabbedPane.showTabSeparators boolean
* @uiDefault TabbedPane.tabSeparatorsFullHeight boolean * @uiDefault TabbedPane.tabSeparatorsFullHeight boolean
* @uiDefault TabbedPane.hasFullBorder boolean * @uiDefault TabbedPane.hasFullBorder boolean
* @uiDefault TabbedPane.hiddenTabsNavigation String moreTabsButton (default) or arrowButtons *
* @uiDefault TabbedPane.tabsPopupPolicy String never or asNeeded (default)
* @uiDefault TabbedPane.scrollButtonsPolicy String never, asNeeded or asNeededSingle (default)
* @uiDefault TabbedPane.scrollButtonsPlacement String both (default) or trailing
*
* @uiDefault TabbedPane.tabAreaAlignment String leading (default), center, trailing or fill * @uiDefault TabbedPane.tabAreaAlignment String leading (default), center, trailing or fill
* @uiDefault TabbedPane.tabAlignment String leading, center (default) or trailing * @uiDefault TabbedPane.tabAlignment String leading, center (default) or trailing
* @uiDefault TabbedPane.tabWidthMode String preferred (default), equal or compact * @uiDefault TabbedPane.tabWidthMode String preferred (default), equal or compact
@@ -150,9 +154,14 @@ import com.formdev.flatlaf.util.UIScale;
public class FlatTabbedPaneUI public class FlatTabbedPaneUI
extends BasicTabbedPaneUI extends BasicTabbedPaneUI
{ {
// hidden tabs navigation types // tabs popup policy / scroll arrows policy
protected static final int MORE_TABS_BUTTON = 0; protected static final int NEVER = 0;
protected static final int ARROW_BUTTONS = 1; // protected static final int ALWAYS = 1;
protected static final int AS_NEEDED = 2;
protected static final int AS_NEEDED_SINGLE = 3;
// scroll arrows placement
protected static final int BOTH = 100;
// tab area alignment // tab area alignment
protected static final int FILL = 100; protected static final int FILL = 100;
@@ -186,10 +195,13 @@ public class FlatTabbedPaneUI
protected boolean hasFullBorder; protected boolean hasFullBorder;
protected boolean tabsOpaque = true; protected boolean tabsOpaque = true;
private String hiddenTabsNavigationStr; private int tabsPopupPolicy;
protected int tabAreaAlignment; private int scrollButtonsPolicy;
protected int tabAlignment; private int scrollButtonsPlacement;
private String tabWidthModeStr;
private int tabAreaAlignment;
private int tabAlignment;
private int tabWidthMode;
protected Icon closeIcon; protected Icon closeIcon;
protected String arrowType; protected String arrowType;
@@ -273,10 +285,14 @@ public class FlatTabbedPaneUI
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" );
hiddenTabsNavigationStr = UIManager.getString( "TabbedPane.hiddenTabsNavigation" );
tabsPopupPolicy = parseTabsPopupPolicy( UIManager.getString( "TabbedPane.tabsPopupPolicy" ) );
scrollButtonsPolicy = parseScrollButtonsPolicy( UIManager.getString( "TabbedPane.scrollButtonsPolicy" ) );
scrollButtonsPlacement = parseScrollButtonsPlacement( UIManager.getString( "TabbedPane.scrollButtonsPlacement" ) );
tabAreaAlignment = parseAlignment( UIManager.getString( "TabbedPane.tabAreaAlignment" ), LEADING ); tabAreaAlignment = parseAlignment( UIManager.getString( "TabbedPane.tabAreaAlignment" ), LEADING );
tabAlignment = parseAlignment( UIManager.getString( "TabbedPane.tabAlignment" ), CENTER ); tabAlignment = parseAlignment( UIManager.getString( "TabbedPane.tabAlignment" ), CENTER );
tabWidthModeStr = UIManager.getString( "TabbedPane.tabWidthMode" ); tabWidthMode = parseTabWidthMode( UIManager.getString( "TabbedPane.tabWidthMode" ) );
closeIcon = UIManager.getIcon( "TabbedPane.closeIcon" ); closeIcon = UIManager.getIcon( "TabbedPane.closeIcon" );
buttonInsets = UIManager.getInsets( "TabbedPane.buttonInsets" ); buttonInsets = UIManager.getInsets( "TabbedPane.buttonInsets" );
@@ -1197,11 +1213,28 @@ public class FlatTabbedPaneUI
return UIManager.getBoolean( "ScrollPane.smoothScrolling" ); return UIManager.getBoolean( "ScrollPane.smoothScrolling" );
} }
protected int getHiddenTabsNavigation() { protected int getTabsPopupPolicy() {
String str = (String) tabPane.getClientProperty( TABBED_PANE_HIDDEN_TABS_NAVIGATION ); Object value = tabPane.getClientProperty( TABBED_PANE_TABS_POPUP_POLICY );
if( str == null )
str = hiddenTabsNavigationStr; return (value instanceof String)
return parseHiddenTabsNavigation( str ); ? parseTabsPopupPolicy( (String) value )
: tabsPopupPolicy;
}
protected int getScrollButtonsPolicy() {
Object value = tabPane.getClientProperty( TABBED_PANE_SCROLL_BUTTONS_POLICY );
return (value instanceof String)
? parseScrollButtonsPolicy( (String) value )
: scrollButtonsPolicy;
}
protected int getScrollButtonsPlacement() {
Object value = tabPane.getClientProperty( TABBED_PANE_SCROLL_BUTTONS_PLACEMENT );
return (value instanceof String)
? parseScrollButtonsPlacement( (String) value )
: scrollButtonsPlacement;
} }
protected int getTabAreaAlignment() { protected int getTabAreaAlignment() {
@@ -1225,20 +1258,44 @@ public class FlatTabbedPaneUI
} }
protected int getTabWidthMode() { protected int getTabWidthMode() {
String str = (String) tabPane.getClientProperty( TABBED_PANE_TAB_WIDTH_MODE ); Object value = tabPane.getClientProperty( TABBED_PANE_TAB_WIDTH_MODE );
if( str == null )
str = tabWidthModeStr; return (value instanceof String)
return parseTabWidthMode( str ); ? parseTabWidthMode( (String) value )
: tabWidthMode;
} }
protected static int parseHiddenTabsNavigation( String str ) { protected static int parseTabsPopupPolicy( String str ) {
if( str == null ) if( str == null )
return MORE_TABS_BUTTON; return AS_NEEDED;
switch( str ) { switch( str ) {
default: default:
case TABBED_PANE_HIDDEN_TABS_NAVIGATION_MORE_TABS_BUTTON: return MORE_TABS_BUTTON; case TABBED_PANE_POLICY_AS_NEEDED: return AS_NEEDED;
case TABBED_PANE_HIDDEN_TABS_NAVIGATION_ARROW_BUTTONS: return ARROW_BUTTONS; case TABBED_PANE_POLICY_NEVER: return NEVER;
}
}
protected static int parseScrollButtonsPolicy( String str ) {
if( str == null )
return AS_NEEDED_SINGLE;
switch( str ) {
default:
case TABBED_PANE_POLICY_AS_NEEDED_SINGLE: return AS_NEEDED_SINGLE;
case TABBED_PANE_POLICY_AS_NEEDED: return AS_NEEDED;
case TABBED_PANE_POLICY_NEVER: return NEVER;
}
}
protected static int parseScrollButtonsPlacement( String str ) {
if( str == null )
return BOTH;
switch( str ) {
default:
case TABBED_PANE_PLACEMENT_BOTH: return BOTH;
case TABBED_PANE_PLACEMENT_TRAILING: return TRAILING;
} }
} }
@@ -1419,6 +1476,7 @@ public class FlatTabbedPaneUI
super( direction, arrowType, super( direction, arrowType,
FlatTabbedPaneUI.this.foreground, FlatTabbedPaneUI.this.disabledForeground, FlatTabbedPaneUI.this.foreground, FlatTabbedPaneUI.this.disabledForeground,
null, buttonHoverBackground, null, buttonPressedBackground ); null, buttonHoverBackground, null, buttonPressedBackground );
setArrowWidth( 10 );
} }
@Override @Override
@@ -2127,7 +2185,11 @@ public class FlatTabbedPaneUI
case TABBED_PANE_TAB_HEIGHT: case TABBED_PANE_TAB_HEIGHT:
case TABBED_PANE_TAB_INSETS: case TABBED_PANE_TAB_INSETS:
case TABBED_PANE_TAB_AREA_INSETS: case TABBED_PANE_TAB_AREA_INSETS:
case TABBED_PANE_HIDDEN_TABS_NAVIGATION:
case TABBED_PANE_TABS_POPUP_POLICY:
case TABBED_PANE_SCROLL_BUTTONS_POLICY:
case TABBED_PANE_SCROLL_BUTTONS_PLACEMENT:
case TABBED_PANE_TAB_AREA_ALIGNMENT: case TABBED_PANE_TAB_AREA_ALIGNMENT:
case TABBED_PANE_TAB_ALIGNMENT: case TABBED_PANE_TAB_ALIGNMENT:
case TABBED_PANE_TAB_WIDTH_MODE: case TABBED_PANE_TAB_WIDTH_MODE:
@@ -2488,14 +2550,23 @@ public class FlatTabbedPaneUI
delegate.layoutContainer( parent ); delegate.layoutContainer( parent );
} ); } );
boolean useMoreButton = (getHiddenTabsNavigation() == MORE_TABS_BUTTON); int tabsPopupPolicy = getTabsPopupPolicy();
int scrollButtonsPolicy = getScrollButtonsPolicy();
int scrollButtonsPlacement = getScrollButtonsPlacement();
boolean useMoreTabsButton = (tabsPopupPolicy == AS_NEEDED);
boolean useScrollButtons = (scrollButtonsPolicy == AS_NEEDED || scrollButtonsPolicy == AS_NEEDED_SINGLE);
boolean hideDisabledScrollButtons = (scrollButtonsPolicy == AS_NEEDED_SINGLE && scrollButtonsPlacement == BOTH);
boolean trailingScrollButtons = (scrollButtonsPlacement == TRAILING);
// for right-to-left always use "more tabs" button for horizontal scrolling // for right-to-left always use "more tabs" button for horizontal scrolling
// because methods scrollForward() and scrollBackward() in class // because methods scrollForward() and scrollBackward() in class
// BasicTabbedPaneUI.ScrollableTabSupport do not work for right-to-left // BasicTabbedPaneUI.ScrollableTabSupport do not work for right-to-left
boolean leftToRight = isLeftToRight(); boolean leftToRight = isLeftToRight();
if( !leftToRight && !useMoreButton && isHorizontalTabPlacement() ) if( !leftToRight && !useMoreTabsButton && isHorizontalTabPlacement() ) {
useMoreButton = true; useMoreTabsButton = true;
useScrollButtons = false;
}
// find backward/forward scroll buttons // find backward/forward scroll buttons
JButton backwardButton = null; JButton backwardButton = null;
@@ -2510,7 +2581,7 @@ public class FlatTabbedPaneUI
} }
} }
if( !useMoreButton && (backwardButton == null || forwardButton == null) ) if( !useMoreTabsButton && (backwardButton == null || forwardButton == null) )
return; // should never occur return; // should never occur
Rectangle bounds = tabPane.getBounds(); Rectangle bounds = tabPane.getBounds();
@@ -2518,10 +2589,9 @@ public class FlatTabbedPaneUI
int tabPlacement = tabPane.getTabPlacement(); int tabPlacement = tabPane.getTabPlacement();
int tabAreaAlignment = getTabAreaAlignment(); int tabAreaAlignment = getTabAreaAlignment();
Insets tabAreaInsets = getRealTabAreaInsets( tabPlacement ); Insets tabAreaInsets = getRealTabAreaInsets( tabPlacement );
Dimension moreButtonSize = useMoreButton ? moreTabsButton.getPreferredSize() : null; boolean moreTabsButtonVisible = false;
Dimension backwardButtonSize = useMoreButton ? null : backwardButton.getPreferredSize(); boolean backwardButtonVisible = false;
Dimension forwardButtonSize = useMoreButton ? null : forwardButton.getPreferredSize(); boolean forwardButtonVisible = false;
boolean buttonsVisible = false;
// TabbedPaneScrollLayout adds tabAreaInsets to tab coordinates, // TabbedPaneScrollLayout adds tabAreaInsets to tab coordinates,
// but we use it to position the viewport // but we use it to position the viewport
@@ -2603,22 +2673,49 @@ public class FlatTabbedPaneUI
int twi = tw - leftWidth - rightWidth - tabAreaInsets.left - tabAreaInsets.right; int twi = tw - leftWidth - rightWidth - tabAreaInsets.left - tabAreaInsets.right;
// layout viewport and buttons // layout viewport and buttons
int viewportWidth = twi; int x = txi;
if( viewportWidth < totalTabWidth ) { int w = twi;
// need buttons
buttonsVisible = true;
int buttonsWidth = useMoreButton ? moreButtonSize.width : (backwardButtonSize.width + forwardButtonSize.width);
viewportWidth = Math.max( viewportWidth - buttonsWidth, 0 );
if( useMoreButton ) if( w < totalTabWidth ) {
moreTabsButton.setBounds( leftToRight ? (txi + twi - buttonsWidth) : txi, ty, moreButtonSize.width, th ); // available width is too small for all tabs --> need buttons
else {
backwardButton.setBounds( leftToRight ? (txi + twi - buttonsWidth) : txi, ty, backwardButtonSize.width, th ); // layout more button on trailing side
forwardButton.setBounds( leftToRight ? (txi + twi - forwardButtonSize.width) : (txi + backwardButtonSize.width), ty, forwardButtonSize.width, th ); if( useMoreTabsButton ) {
int buttonWidth = moreTabsButton.getPreferredSize().width;
moreTabsButton.setBounds( leftToRight ? (x + w - buttonWidth) : x, ty, buttonWidth, th );
x += leftToRight ? 0 : buttonWidth;
w -= buttonWidth;
moreTabsButtonVisible = true;
} }
tabViewport.setBounds( leftToRight ? txi : (txi + buttonsWidth), ty, viewportWidth, th ); if( useScrollButtons ) {
} else // layout forward button on trailing side
tabViewport.setBounds( txi, ty, viewportWidth, th ); if( !hideDisabledScrollButtons || forwardButton.isEnabled() ) {
int buttonWidth = forwardButton.getPreferredSize().width;
forwardButton.setBounds( leftToRight ? (x + w - buttonWidth) : x, ty, buttonWidth, th );
x += leftToRight ? 0 : buttonWidth;
w -= buttonWidth;
forwardButtonVisible = true;
}
// layout backward button
if( !hideDisabledScrollButtons || backwardButton.isEnabled() ) {
int buttonWidth = backwardButton.getPreferredSize().width;
if( trailingScrollButtons ) {
// on trailing side
backwardButton.setBounds( leftToRight ? (x + w - buttonWidth) : x, ty, buttonWidth, th );
x += leftToRight ? 0 : buttonWidth;
} else {
// on leading side
backwardButton.setBounds( leftToRight ? x : (x + w - buttonWidth), ty, buttonWidth, th );
x += leftToRight ? buttonWidth : 0;
}
w -= buttonWidth;
backwardButtonVisible = true;
}
}
}
tabViewport.setBounds( x, ty, w, th );
if( !leftToRight ) { if( !leftToRight ) {
// layout viewport so that we can get correct view width below // layout viewport so that we can get correct view width below
@@ -2686,29 +2783,54 @@ public class FlatTabbedPaneUI
int thi = th - topHeight - bottomHeight - tabAreaInsets.top - tabAreaInsets.bottom; int thi = th - topHeight - bottomHeight - tabAreaInsets.top - tabAreaInsets.bottom;
// layout viewport and buttons // layout viewport and buttons
int viewportHeight = thi; int y = tyi;
if( viewportHeight < totalTabHeight ) { int h = thi;
// need buttons
buttonsVisible = true;
int buttonsHeight = useMoreButton ? moreButtonSize.height : (backwardButtonSize.height + forwardButtonSize.height);
viewportHeight = Math.max( viewportHeight - buttonsHeight, 0 );
if( useMoreButton ) if( h < totalTabHeight ) {
moreTabsButton.setBounds( tx, tyi + thi - buttonsHeight, tw, moreButtonSize.height ); // available height is too small for all tabs --> need buttons
else {
backwardButton.setBounds( tx, tyi + thi - buttonsHeight, tw, backwardButtonSize.height ); // layout more button on bottom side
forwardButton.setBounds( tx, tyi + thi - forwardButtonSize.height, tw, forwardButtonSize.height ); if( useMoreTabsButton ) {
int buttonHeight = moreTabsButton.getPreferredSize().height;
moreTabsButton.setBounds( tx, y + h - buttonHeight, tw, buttonHeight );
h -= buttonHeight;
moreTabsButtonVisible = true;
}
if( useScrollButtons ) {
// layout forward button on bottom side
if( !hideDisabledScrollButtons || forwardButton.isEnabled() ) {
int buttonHeight = forwardButton.getPreferredSize().height;
forwardButton.setBounds( tx, y + h - buttonHeight, tw, buttonHeight );
h -= buttonHeight;
forwardButtonVisible = true;
}
// layout backward button
if( !hideDisabledScrollButtons || backwardButton.isEnabled() ) {
int buttonHeight = backwardButton.getPreferredSize().height;
if( trailingScrollButtons ) {
// on bottom side
backwardButton.setBounds( tx, y + h - buttonHeight, tw, buttonHeight );
} else {
// on top side
backwardButton.setBounds( tx, y, tw, buttonHeight );
y += buttonHeight;
}
h -= buttonHeight;
backwardButtonVisible = true;
}
} }
} }
tabViewport.setBounds( tx, tyi, tw, viewportHeight );
tabViewport.setBounds( tx, y, tw, h );
} }
} }
// show/hide viewport and buttons // show/hide viewport and buttons
tabViewport.setVisible( rects.length > 0 ); tabViewport.setVisible( rects.length > 0 );
moreTabsButton.setVisible( useMoreButton && buttonsVisible ); moreTabsButton.setVisible( moreTabsButtonVisible );
backwardButton.setVisible( !useMoreButton && buttonsVisible ); backwardButton.setVisible( backwardButtonVisible );
forwardButton.setVisible( !useMoreButton && buttonsVisible ); forwardButton.setVisible( forwardButtonVisible );
} }
} }
} }

View File

@@ -573,6 +573,13 @@ TabbedPane.arrowType=chevron
TabbedPane.buttonInsets=2,1,2,1 TabbedPane.buttonInsets=2,1,2,1
TabbedPane.buttonArc=$Button.arc TabbedPane.buttonArc=$Button.arc
# allowed values: never or asNeeded
TabbedPane.tabsPopupPolicy=asNeeded
# allowed values: never, asNeeded or asNeededSingle
TabbedPane.scrollButtonsPolicy=asNeededSingle
# allowed values: both or trailing
TabbedPane.scrollButtonsPlacement=both
TabbedPane.closeIcon=com.formdev.flatlaf.icons.FlatTabbedPaneCloseIcon TabbedPane.closeIcon=com.formdev.flatlaf.icons.FlatTabbedPaneCloseIcon
TabbedPane.closeSize=16,16 TabbedPane.closeSize=16,16
TabbedPane.closeArc=4 TabbedPane.closeArc=4

View File

@@ -137,7 +137,6 @@ public class FlatContainerTest
tabbedPane.addTab( "Tab " + index, createTab( "tab content " + index ) ); tabbedPane.addTab( "Tab " + index, createTab( "tab content " + index ) );
break; break;
} }
} }
private JComponent createTab( String text ) { private JComponent createTab( String text ) {
@@ -262,11 +261,25 @@ public class FlatContainerTest
tabbedPane4.setTabPlacement( (tabPlacement >= 0) ? tabPlacement : SwingConstants.RIGHT ); tabbedPane4.setTabPlacement( (tabPlacement >= 0) ? tabPlacement : SwingConstants.RIGHT );
} }
private void hiddenTabsNavigationChanged() { private void tabsPopupPolicyChanged() {
String value = (String) hiddenTabsNavigationField.getSelectedItem(); String value = (String) tabsPopupPolicyField.getSelectedItem();
if( "default".equals( value ) ) if( "default".equals( value ) )
value = null; value = null;
putTabbedPanesClientProperty( TABBED_PANE_HIDDEN_TABS_NAVIGATION, value ); putTabbedPanesClientProperty( TABBED_PANE_TABS_POPUP_POLICY, value );
}
private void scrollButtonsPolicyChanged() {
String value = (String) scrollButtonsPolicyField.getSelectedItem();
if( "default".equals( value ) )
value = null;
putTabbedPanesClientProperty( TABBED_PANE_SCROLL_BUTTONS_POLICY, value );
}
private void scrollButtonsPlacementChanged() {
String value = (String) scrollButtonsPlacementField.getSelectedItem();
if( "default".equals( value ) )
value = null;
putTabbedPanesClientProperty( TABBED_PANE_SCROLL_BUTTONS_PLACEMENT, value );
} }
private void tabAreaAlignmentChanged() { private void tabAreaAlignmentChanged() {
@@ -417,33 +430,37 @@ public class FlatContainerTest
customTabsCheckBox = new JCheckBox(); customTabsCheckBox = new JCheckBox();
htmlTabsCheckBox = new JCheckBox(); htmlTabsCheckBox = new JCheckBox();
multiLineTabsCheckBox = new JCheckBox(); multiLineTabsCheckBox = new JCheckBox();
JLabel hiddenTabsNavigationLabel = new JLabel(); JLabel tabsPopupPolicyLabel = new JLabel();
hiddenTabsNavigationField = new JComboBox<>(); tabsPopupPolicyField = new JComboBox<>();
tabBackForegroundCheckBox = new JCheckBox(); tabBackForegroundCheckBox = new JCheckBox();
JLabel tabPlacementLabel = new JLabel(); JLabel scrollButtonsPolicyLabel = new JLabel();
tabPlacementField = new JComboBox<>(); scrollButtonsPolicyField = new JComboBox<>();
tabIconsCheckBox = new JCheckBox(); tabIconsCheckBox = new JCheckBox();
tabIconSizeSpinner = new JSpinner(); tabIconSizeSpinner = new JSpinner();
iconPlacementField = new JComboBox<>(); iconPlacementField = new JComboBox<>();
JLabel scrollButtonsPlacementLabel = new JLabel();
scrollButtonsPlacementField = new JComboBox<>();
tabsClosableCheckBox = new JCheckBox();
JLabel tabPlacementLabel = new JLabel();
tabPlacementField = new JComboBox<>();
secondTabClosableCheckBox = new TriStateCheckBox();
JLabel tabAreaAlignmentLabel = new JLabel(); JLabel tabAreaAlignmentLabel = new JLabel();
tabAreaAlignmentField = new JComboBox<>(); tabAreaAlignmentField = new JComboBox<>();
tabAlignmentField = new JComboBox<>(); tabAlignmentField = new JComboBox<>();
JLabel tabWidthModeLabel = new JLabel(); JLabel tabWidthModeLabel = new JLabel();
tabWidthModeField = new JComboBox<>(); tabWidthModeField = new JComboBox<>();
tabsClosableCheckBox = new JCheckBox(); leadingComponentCheckBox = new JCheckBox();
customBorderCheckBox = new JCheckBox(); customBorderCheckBox = new JCheckBox();
tabAreaInsetsCheckBox = new JCheckBox(); tabAreaInsetsCheckBox = new JCheckBox();
secondTabClosableCheckBox = new TriStateCheckBox(); trailingComponentCheckBox = new JCheckBox();
hasFullBorderCheckBox = new JCheckBox(); hasFullBorderCheckBox = new JCheckBox();
smallerTabHeightCheckBox = new JCheckBox(); smallerTabHeightCheckBox = new JCheckBox();
leadingComponentCheckBox = new JCheckBox(); minimumTabWidthCheckBox = new JCheckBox();
hideContentSeparatorCheckBox = new JCheckBox(); hideContentSeparatorCheckBox = new JCheckBox();
smallerInsetsCheckBox = new JCheckBox(); smallerInsetsCheckBox = new JCheckBox();
trailingComponentCheckBox = new JCheckBox(); maximumTabWidthCheckBox = new JCheckBox();
showTabSeparatorsCheckBox = new JCheckBox(); showTabSeparatorsCheckBox = new JCheckBox();
secondTabWiderCheckBox = new JCheckBox(); secondTabWiderCheckBox = new JCheckBox();
minimumTabWidthCheckBox = new JCheckBox();
maximumTabWidthCheckBox = new JCheckBox();
CellConstraints cc = new CellConstraints(); CellConstraints cc = new CellConstraints();
//======== this ======== //======== this ========
@@ -556,7 +573,7 @@ public class FlatContainerTest
"[center]" + "[center]" +
"[]" + "[]" +
"[]" + "[]" +
"[]para" + "[]" +
"[]" + "[]" +
"[]para" + "[]para" +
"[]" + "[]" +
@@ -594,38 +611,37 @@ public class FlatContainerTest
multiLineTabsCheckBox.addActionListener(e -> htmlTabsChanged()); multiLineTabsCheckBox.addActionListener(e -> htmlTabsChanged());
tabbedPaneControlPanel.add(multiLineTabsCheckBox, "cell 2 0"); tabbedPaneControlPanel.add(multiLineTabsCheckBox, "cell 2 0");
//---- hiddenTabsNavigationLabel ---- //---- tabsPopupPolicyLabel ----
hiddenTabsNavigationLabel.setText("Hidden tabs navigation:"); tabsPopupPolicyLabel.setText("Tabs popup policy:");
tabbedPaneControlPanel.add(hiddenTabsNavigationLabel, "cell 0 1"); tabbedPaneControlPanel.add(tabsPopupPolicyLabel, "cell 0 1");
//---- hiddenTabsNavigationField ---- //---- tabsPopupPolicyField ----
hiddenTabsNavigationField.setModel(new DefaultComboBoxModel<>(new String[] { tabsPopupPolicyField.setModel(new DefaultComboBoxModel<>(new String[] {
"default", "default",
"moreTabsButton", "asNeeded",
"arrowButtons" "never"
})); }));
hiddenTabsNavigationField.addActionListener(e -> hiddenTabsNavigationChanged()); tabsPopupPolicyField.addActionListener(e -> tabsPopupPolicyChanged());
tabbedPaneControlPanel.add(hiddenTabsNavigationField, "cell 1 1"); tabbedPaneControlPanel.add(tabsPopupPolicyField, "cell 1 1");
//---- tabBackForegroundCheckBox ---- //---- tabBackForegroundCheckBox ----
tabBackForegroundCheckBox.setText("Tab back/foreground"); tabBackForegroundCheckBox.setText("Tab back/foreground");
tabBackForegroundCheckBox.addActionListener(e -> tabBackForegroundChanged()); tabBackForegroundCheckBox.addActionListener(e -> tabBackForegroundChanged());
tabbedPaneControlPanel.add(tabBackForegroundCheckBox, "cell 2 1"); tabbedPaneControlPanel.add(tabBackForegroundCheckBox, "cell 2 1");
//---- tabPlacementLabel ---- //---- scrollButtonsPolicyLabel ----
tabPlacementLabel.setText("Tab placement:"); scrollButtonsPolicyLabel.setText("Scroll buttons policy:");
tabbedPaneControlPanel.add(tabPlacementLabel, "cell 0 2"); tabbedPaneControlPanel.add(scrollButtonsPolicyLabel, "cell 0 2");
//---- tabPlacementField ---- //---- scrollButtonsPolicyField ----
tabPlacementField.setModel(new DefaultComboBoxModel<>(new String[] { scrollButtonsPolicyField.setModel(new DefaultComboBoxModel<>(new String[] {
"default", "default",
"top", "asNeededSingle",
"bottom", "asNeeded",
"left", "never"
"right"
})); }));
tabPlacementField.addActionListener(e -> tabPlacementChanged()); scrollButtonsPolicyField.addActionListener(e -> scrollButtonsPolicyChanged());
tabbedPaneControlPanel.add(tabPlacementField, "cell 1 2"); tabbedPaneControlPanel.add(scrollButtonsPolicyField, "cell 1 2");
//---- tabIconsCheckBox ---- //---- tabIconsCheckBox ----
tabIconsCheckBox.setText("Tab icons"); tabIconsCheckBox.setText("Tab icons");
@@ -648,9 +664,47 @@ public class FlatContainerTest
iconPlacementField.addActionListener(e -> iconPlacementChanged()); iconPlacementField.addActionListener(e -> iconPlacementChanged());
tabbedPaneControlPanel.add(iconPlacementField, "cell 2 2"); tabbedPaneControlPanel.add(iconPlacementField, "cell 2 2");
//---- scrollButtonsPlacementLabel ----
scrollButtonsPlacementLabel.setText("Scroll buttons placement:");
tabbedPaneControlPanel.add(scrollButtonsPlacementLabel, "cell 0 3");
//---- scrollButtonsPlacementField ----
scrollButtonsPlacementField.setModel(new DefaultComboBoxModel<>(new String[] {
"default",
"both",
"trailing"
}));
scrollButtonsPlacementField.addActionListener(e -> scrollButtonsPlacementChanged());
tabbedPaneControlPanel.add(scrollButtonsPlacementField, "cell 1 3");
//---- tabsClosableCheckBox ----
tabsClosableCheckBox.setText("Tabs closable");
tabsClosableCheckBox.addActionListener(e -> tabsClosableChanged());
tabbedPaneControlPanel.add(tabsClosableCheckBox, "cell 2 3");
//---- tabPlacementLabel ----
tabPlacementLabel.setText("Tab placement:");
tabbedPaneControlPanel.add(tabPlacementLabel, "cell 0 4");
//---- tabPlacementField ----
tabPlacementField.setModel(new DefaultComboBoxModel<>(new String[] {
"default",
"top",
"bottom",
"left",
"right"
}));
tabPlacementField.addActionListener(e -> tabPlacementChanged());
tabbedPaneControlPanel.add(tabPlacementField, "cell 1 4");
//---- secondTabClosableCheckBox ----
secondTabClosableCheckBox.setText("Second Tab closable");
secondTabClosableCheckBox.addActionListener(e -> secondTabClosableChanged());
tabbedPaneControlPanel.add(secondTabClosableCheckBox, "cell 2 4");
//---- tabAreaAlignmentLabel ---- //---- tabAreaAlignmentLabel ----
tabAreaAlignmentLabel.setText("Tab area/title alignment:"); tabAreaAlignmentLabel.setText("Tab area/title alignment:");
tabbedPaneControlPanel.add(tabAreaAlignmentLabel, "cell 0 3"); tabbedPaneControlPanel.add(tabAreaAlignmentLabel, "cell 0 5");
//---- tabAreaAlignmentField ---- //---- tabAreaAlignmentField ----
tabAreaAlignmentField.setModel(new DefaultComboBoxModel<>(new String[] { tabAreaAlignmentField.setModel(new DefaultComboBoxModel<>(new String[] {
@@ -661,7 +715,7 @@ public class FlatContainerTest
"fill" "fill"
})); }));
tabAreaAlignmentField.addActionListener(e -> tabAreaAlignmentChanged()); tabAreaAlignmentField.addActionListener(e -> tabAreaAlignmentChanged());
tabbedPaneControlPanel.add(tabAreaAlignmentField, "cell 1 3"); tabbedPaneControlPanel.add(tabAreaAlignmentField, "cell 1 5");
//---- tabAlignmentField ---- //---- tabAlignmentField ----
tabAlignmentField.setModel(new DefaultComboBoxModel<>(new String[] { tabAlignmentField.setModel(new DefaultComboBoxModel<>(new String[] {
@@ -671,11 +725,11 @@ public class FlatContainerTest
"center" "center"
})); }));
tabAlignmentField.addActionListener(e -> tabAlignmentChanged()); tabAlignmentField.addActionListener(e -> tabAlignmentChanged());
tabbedPaneControlPanel.add(tabAlignmentField, "cell 1 3"); tabbedPaneControlPanel.add(tabAlignmentField, "cell 1 5");
//---- tabWidthModeLabel ---- //---- tabWidthModeLabel ----
tabWidthModeLabel.setText("Tab width mode:"); tabWidthModeLabel.setText("Tab width mode:");
tabbedPaneControlPanel.add(tabWidthModeLabel, "cell 2 3"); tabbedPaneControlPanel.add(tabWidthModeLabel, "cell 2 5");
//---- tabWidthModeField ---- //---- tabWidthModeField ----
tabWidthModeField.setModel(new DefaultComboBoxModel<>(new String[] { tabWidthModeField.setModel(new DefaultComboBoxModel<>(new String[] {
@@ -685,77 +739,67 @@ public class FlatContainerTest
"compact" "compact"
})); }));
tabWidthModeField.addActionListener(e -> tabWidthModeChanged()); tabWidthModeField.addActionListener(e -> tabWidthModeChanged());
tabbedPaneControlPanel.add(tabWidthModeField, "cell 2 3"); tabbedPaneControlPanel.add(tabWidthModeField, "cell 2 5");
//---- tabsClosableCheckBox ----
tabsClosableCheckBox.setText("Tabs closable");
tabsClosableCheckBox.addActionListener(e -> tabsClosableChanged());
tabbedPaneControlPanel.add(tabsClosableCheckBox, "cell 0 4");
//---- customBorderCheckBox ----
customBorderCheckBox.setText("Custom border");
customBorderCheckBox.addActionListener(e -> customBorderChanged());
tabbedPaneControlPanel.add(customBorderCheckBox, "cell 1 4");
//---- tabAreaInsetsCheckBox ----
tabAreaInsetsCheckBox.setText("Tab area insets (5,5,10,10)");
tabAreaInsetsCheckBox.addActionListener(e -> tabAreaInsetsChanged());
tabbedPaneControlPanel.add(tabAreaInsetsCheckBox, "cell 2 4");
//---- secondTabClosableCheckBox ----
secondTabClosableCheckBox.setText("Second Tab closable");
secondTabClosableCheckBox.addActionListener(e -> secondTabClosableChanged());
tabbedPaneControlPanel.add(secondTabClosableCheckBox, "cell 0 5");
//---- hasFullBorderCheckBox ----
hasFullBorderCheckBox.setText("Show content border");
hasFullBorderCheckBox.addActionListener(e -> hasFullBorderChanged());
tabbedPaneControlPanel.add(hasFullBorderCheckBox, "cell 1 5,alignx left,growx 0");
//---- smallerTabHeightCheckBox ----
smallerTabHeightCheckBox.setText("Smaller tab height (26)");
smallerTabHeightCheckBox.addActionListener(e -> smallerTabHeightChanged());
tabbedPaneControlPanel.add(smallerTabHeightCheckBox, "cell 2 5");
//---- 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 6");
//---- hideContentSeparatorCheckBox ---- //---- customBorderCheckBox ----
hideContentSeparatorCheckBox.setText("Hide content separator"); customBorderCheckBox.setText("Custom border");
hideContentSeparatorCheckBox.addActionListener(e -> hideContentSeparatorChanged()); customBorderCheckBox.addActionListener(e -> customBorderChanged());
tabbedPaneControlPanel.add(hideContentSeparatorCheckBox, "cell 1 6"); tabbedPaneControlPanel.add(customBorderCheckBox, "cell 1 6");
//---- smallerInsetsCheckBox ---- //---- tabAreaInsetsCheckBox ----
smallerInsetsCheckBox.setText("Smaller tab insets (2,2,2,2)"); tabAreaInsetsCheckBox.setText("Tab area insets (5,5,10,10)");
smallerInsetsCheckBox.addActionListener(e -> smallerInsetsChanged()); tabAreaInsetsCheckBox.addActionListener(e -> tabAreaInsetsChanged());
tabbedPaneControlPanel.add(smallerInsetsCheckBox, "cell 2 6"); tabbedPaneControlPanel.add(tabAreaInsetsCheckBox, "cell 2 6");
//---- 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 7");
//---- showTabSeparatorsCheckBox ---- //---- hasFullBorderCheckBox ----
showTabSeparatorsCheckBox.setText("Show tab separators"); hasFullBorderCheckBox.setText("Show content border");
showTabSeparatorsCheckBox.addActionListener(e -> showTabSeparatorsChanged()); hasFullBorderCheckBox.addActionListener(e -> hasFullBorderChanged());
tabbedPaneControlPanel.add(showTabSeparatorsCheckBox, "cell 1 7"); tabbedPaneControlPanel.add(hasFullBorderCheckBox, "cell 1 7,alignx left,growx 0");
//---- secondTabWiderCheckBox ---- //---- smallerTabHeightCheckBox ----
secondTabWiderCheckBox.setText("Second Tab insets wider (4,20,4,20)"); smallerTabHeightCheckBox.setText("Smaller tab height (26)");
secondTabWiderCheckBox.addActionListener(e -> secondTabWiderChanged()); smallerTabHeightCheckBox.addActionListener(e -> smallerTabHeightChanged());
tabbedPaneControlPanel.add(secondTabWiderCheckBox, "cell 2 7"); tabbedPaneControlPanel.add(smallerTabHeightCheckBox, "cell 2 7");
//---- 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 2 8"); tabbedPaneControlPanel.add(minimumTabWidthCheckBox, "cell 0 8");
//---- hideContentSeparatorCheckBox ----
hideContentSeparatorCheckBox.setText("Hide content separator");
hideContentSeparatorCheckBox.addActionListener(e -> hideContentSeparatorChanged());
tabbedPaneControlPanel.add(hideContentSeparatorCheckBox, "cell 1 8");
//---- smallerInsetsCheckBox ----
smallerInsetsCheckBox.setText("Smaller tab insets (2,2,2,2)");
smallerInsetsCheckBox.addActionListener(e -> smallerInsetsChanged());
tabbedPaneControlPanel.add(smallerInsetsCheckBox, "cell 2 8");
//---- 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 2 9"); tabbedPaneControlPanel.add(maximumTabWidthCheckBox, "cell 0 9");
//---- showTabSeparatorsCheckBox ----
showTabSeparatorsCheckBox.setText("Show tab separators");
showTabSeparatorsCheckBox.addActionListener(e -> showTabSeparatorsChanged());
tabbedPaneControlPanel.add(showTabSeparatorsCheckBox, "cell 1 9");
//---- secondTabWiderCheckBox ----
secondTabWiderCheckBox.setText("Second Tab insets wider (4,20,4,20)");
secondTabWiderCheckBox.addActionListener(e -> secondTabWiderChanged());
tabbedPaneControlPanel.add(secondTabWiderCheckBox, "cell 2 9");
} }
panel9.add(tabbedPaneControlPanel, cc.xywh(1, 11, 3, 1)); panel9.add(tabbedPaneControlPanel, cc.xywh(1, 11, 3, 1));
} }
@@ -775,29 +819,31 @@ public class FlatContainerTest
private JCheckBox customTabsCheckBox; private JCheckBox customTabsCheckBox;
private JCheckBox htmlTabsCheckBox; private JCheckBox htmlTabsCheckBox;
private JCheckBox multiLineTabsCheckBox; private JCheckBox multiLineTabsCheckBox;
private JComboBox<String> hiddenTabsNavigationField; private JComboBox<String> tabsPopupPolicyField;
private JCheckBox tabBackForegroundCheckBox; private JCheckBox tabBackForegroundCheckBox;
private JComboBox<String> tabPlacementField; private JComboBox<String> scrollButtonsPolicyField;
private JCheckBox tabIconsCheckBox; private JCheckBox tabIconsCheckBox;
private JSpinner tabIconSizeSpinner; private JSpinner tabIconSizeSpinner;
private JComboBox<String> iconPlacementField; private JComboBox<String> iconPlacementField;
private JComboBox<String> scrollButtonsPlacementField;
private JCheckBox tabsClosableCheckBox;
private JComboBox<String> tabPlacementField;
private TriStateCheckBox secondTabClosableCheckBox;
private JComboBox<String> tabAreaAlignmentField; private JComboBox<String> tabAreaAlignmentField;
private JComboBox<String> tabAlignmentField; private JComboBox<String> tabAlignmentField;
private JComboBox<String> tabWidthModeField; private JComboBox<String> tabWidthModeField;
private JCheckBox tabsClosableCheckBox; private JCheckBox leadingComponentCheckBox;
private JCheckBox customBorderCheckBox; private JCheckBox customBorderCheckBox;
private JCheckBox tabAreaInsetsCheckBox; private JCheckBox tabAreaInsetsCheckBox;
private TriStateCheckBox secondTabClosableCheckBox; private JCheckBox trailingComponentCheckBox;
private JCheckBox hasFullBorderCheckBox; private JCheckBox hasFullBorderCheckBox;
private JCheckBox smallerTabHeightCheckBox; private JCheckBox smallerTabHeightCheckBox;
private JCheckBox leadingComponentCheckBox; private JCheckBox minimumTabWidthCheckBox;
private JCheckBox hideContentSeparatorCheckBox; private JCheckBox hideContentSeparatorCheckBox;
private JCheckBox smallerInsetsCheckBox; private JCheckBox smallerInsetsCheckBox;
private JCheckBox trailingComponentCheckBox; private JCheckBox maximumTabWidthCheckBox;
private JCheckBox showTabSeparatorsCheckBox; private JCheckBox showTabSeparatorsCheckBox;
private JCheckBox secondTabWiderCheckBox; private JCheckBox secondTabWiderCheckBox;
private JCheckBox minimumTabWidthCheckBox;
private JCheckBox maximumTabWidthCheckBox;
// JFormDesigner - End of variables declaration //GEN-END:variables // JFormDesigner - End of variables declaration //GEN-END:variables
private JTabbedPane[] allTabbedPanes; private JTabbedPane[] allTabbedPanes;

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[][]para[][]" "$rowConstraints": "[center][][][][][]para[][]para[][]"
} ) { } ) {
name: "tabbedPaneControlPanel" name: "tabbedPaneControlPanel"
"opaque": false "opaque": false
@@ -197,24 +197,24 @@ new FormModel {
"value": "cell 2 0" "value": "cell 2 0"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "hiddenTabsNavigationLabel" name: "tabsPopupPolicyLabel"
"text": "Hidden tabs navigation:" "text": "Tabs popup policy:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1" "value": "cell 0 1"
} ) } )
add( new FormComponent( "javax.swing.JComboBox" ) { add( new FormComponent( "javax.swing.JComboBox" ) {
name: "hiddenTabsNavigationField" name: "tabsPopupPolicyField"
"model": new javax.swing.DefaultComboBoxModel { "model": new javax.swing.DefaultComboBoxModel {
selectedItem: "default" selectedItem: "default"
addElement( "default" ) addElement( "default" )
addElement( "moreTabsButton" ) addElement( "asNeeded" )
addElement( "arrowButtons" ) addElement( "never" )
} }
auxiliary() { auxiliary() {
"JavaCodeGenerator.variableLocal": false "JavaCodeGenerator.variableLocal": false
"JavaCodeGenerator.typeParameters": "String" "JavaCodeGenerator.typeParameters": "String"
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hiddenTabsNavigationChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabsPopupPolicyChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 1" "value": "cell 1 1"
} ) } )
@@ -229,26 +229,25 @@ new FormModel {
"value": "cell 2 1" "value": "cell 2 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "tabPlacementLabel" name: "scrollButtonsPolicyLabel"
"text": "Tab placement:" "text": "Scroll buttons policy:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2" "value": "cell 0 2"
} ) } )
add( new FormComponent( "javax.swing.JComboBox" ) { add( new FormComponent( "javax.swing.JComboBox" ) {
name: "tabPlacementField" name: "scrollButtonsPolicyField"
"model": new javax.swing.DefaultComboBoxModel { "model": new javax.swing.DefaultComboBoxModel {
selectedItem: "default" selectedItem: "default"
addElement( "default" ) addElement( "default" )
addElement( "top" ) addElement( "asNeededSingle" )
addElement( "bottom" ) addElement( "asNeeded" )
addElement( "left" ) addElement( "never" )
addElement( "right" )
} }
auxiliary() { auxiliary() {
"JavaCodeGenerator.variableLocal": false "JavaCodeGenerator.variableLocal": false
"JavaCodeGenerator.typeParameters": "String" "JavaCodeGenerator.typeParameters": "String"
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabPlacementChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "scrollButtonsPolicyChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2" "value": "cell 1 2"
} ) } )
@@ -298,11 +297,77 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 2" "value": "cell 2 2"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "scrollButtonsPlacementLabel"
"text": "Scroll buttons placement:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3"
} )
add( new FormComponent( "javax.swing.JComboBox" ) {
name: "scrollButtonsPlacementField"
"model": new javax.swing.DefaultComboBoxModel {
selectedItem: "default"
addElement( "default" )
addElement( "both" )
addElement( "trailing" )
}
auxiliary() {
"JavaCodeGenerator.variableLocal": false
"JavaCodeGenerator.typeParameters": "String"
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "scrollButtonsPlacementChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "tabsClosableCheckBox"
"text": "Tabs closable"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabsClosableChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 3"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "tabPlacementLabel"
"text": "Tab placement:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 4"
} )
add( new FormComponent( "javax.swing.JComboBox" ) {
name: "tabPlacementField"
"model": new javax.swing.DefaultComboBoxModel {
selectedItem: "default"
addElement( "default" )
addElement( "top" )
addElement( "bottom" )
addElement( "left" )
addElement( "right" )
}
auxiliary() {
"JavaCodeGenerator.variableLocal": false
"JavaCodeGenerator.typeParameters": "String"
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabPlacementChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 4"
} )
add( new FormComponent( "com.formdev.flatlaf.extras.TriStateCheckBox" ) {
name: "secondTabClosableCheckBox"
"text": "Second Tab closable"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "secondTabClosableChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 4"
} )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "tabAreaAlignmentLabel" name: "tabAreaAlignmentLabel"
"text": "Tab area/title alignment:" "text": "Tab area/title alignment:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3" "value": "cell 0 5"
} ) } )
add( new FormComponent( "javax.swing.JComboBox" ) { add( new FormComponent( "javax.swing.JComboBox" ) {
name: "tabAreaAlignmentField" name: "tabAreaAlignmentField"
@@ -320,7 +385,7 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabAreaAlignmentChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabAreaAlignmentChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3" "value": "cell 1 5"
} ) } )
add( new FormComponent( "javax.swing.JComboBox" ) { add( new FormComponent( "javax.swing.JComboBox" ) {
name: "tabAlignmentField" name: "tabAlignmentField"
@@ -337,13 +402,13 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabAlignmentChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabAlignmentChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3" "value": "cell 1 5"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "tabWidthModeLabel" name: "tabWidthModeLabel"
"text": "Tab width mode:" "text": "Tab width mode:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 3" "value": "cell 2 5"
} ) } )
add( new FormComponent( "javax.swing.JComboBox" ) { add( new FormComponent( "javax.swing.JComboBox" ) {
name: "tabWidthModeField" name: "tabWidthModeField"
@@ -359,66 +424,6 @@ new FormModel {
"JavaCodeGenerator.typeParameters": "String" "JavaCodeGenerator.typeParameters": "String"
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabWidthModeChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabWidthModeChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 3"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "tabsClosableCheckBox"
"text": "Tabs closable"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabsClosableChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 4"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "customBorderCheckBox"
"text": "Custom border"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "customBorderChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 4"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "tabAreaInsetsCheckBox"
"text": "Tab area insets (5,5,10,10)"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabAreaInsetsChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 4"
} )
add( new FormComponent( "com.formdev.flatlaf.extras.TriStateCheckBox" ) {
name: "secondTabClosableCheckBox"
"text": "Second Tab closable"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "secondTabClosableChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 5"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "hasFullBorderCheckBox"
"text": "Show content border"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hasFullBorderChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 5,alignx left,growx 0"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "smallerTabHeightCheckBox"
"text": "Smaller tab height (26)"
auxiliary() {
"JavaCodeGenerator.variableLocal": 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 5" "value": "cell 2 5"
} ) } )
@@ -433,22 +438,22 @@ new FormModel {
"value": "cell 0 6" "value": "cell 0 6"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "hideContentSeparatorCheckBox" name: "customBorderCheckBox"
"text": "Hide content separator" "text": "Custom border"
auxiliary() { auxiliary() {
"JavaCodeGenerator.variableLocal": false "JavaCodeGenerator.variableLocal": false
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hideContentSeparatorChanged", 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 6"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "smallerInsetsCheckBox" name: "tabAreaInsetsCheckBox"
"text": "Smaller tab insets (2,2,2,2)" "text": "Tab area insets (5,5,10,10)"
auxiliary() { auxiliary() {
"JavaCodeGenerator.variableLocal": false "JavaCodeGenerator.variableLocal": false
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "smallerInsetsChanged", 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 6"
} ) } )
@@ -463,22 +468,22 @@ new FormModel {
"value": "cell 0 7" "value": "cell 0 7"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "showTabSeparatorsCheckBox" name: "hasFullBorderCheckBox"
"text": "Show tab separators" "text": "Show content border"
auxiliary() { auxiliary() {
"JavaCodeGenerator.variableLocal": false "JavaCodeGenerator.variableLocal": false
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showTabSeparatorsChanged", 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" "value": "cell 1 7,alignx left,growx 0"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "secondTabWiderCheckBox" name: "smallerTabHeightCheckBox"
"text": "Second Tab insets wider (4,20,4,20)" "text": "Smaller tab height (26)"
auxiliary() { auxiliary() {
"JavaCodeGenerator.variableLocal": false "JavaCodeGenerator.variableLocal": false
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "secondTabWiderChanged", 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 7"
} ) } )
@@ -489,6 +494,26 @@ new FormModel {
"JavaCodeGenerator.variableLocal": false "JavaCodeGenerator.variableLocal": false
} }
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 ) {
"value": "cell 0 8"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "hideContentSeparatorCheckBox"
"text": "Hide content separator"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hideContentSeparatorChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 8"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "smallerInsetsCheckBox"
"text": "Smaller tab insets (2,2,2,2)"
auxiliary() {
"JavaCodeGenerator.variableLocal": 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 8"
} ) } )
@@ -499,6 +524,26 @@ new FormModel {
"JavaCodeGenerator.variableLocal": false "JavaCodeGenerator.variableLocal": false
} }
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 ) {
"value": "cell 0 9"
} )
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 1 9"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "secondTabWiderCheckBox"
"text": "Second Tab insets wider (4,20,4,20)"
auxiliary() {
"JavaCodeGenerator.variableLocal": 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 9"
} ) } )