diff --git a/CHANGELOG.md b/CHANGELOG.md
index 64d3c4be..237afbc8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,9 @@ FlatLaf Change Log
- TabbedPane: Support closable tabs. (PR #193; issues #31 and #40)
- TabbedPane: Support minimum or maximum tab widths. (set client property
`JTabbedPane.minimumTabWidth` or `JTabbedPane.maximumTabWidth` to an integer)
+- TabbedPane: Support alignment of tab area. (set client property
+ `JTabbedPane.tabAreaAlignment` to `"leading"`, `"trailing"`, `"center"` or
+ `"fill"`)
- Support painting separator line between window title and content (use UI value
`TitlePane.borderColor`). (issue #184)
- Extras: `FlatSVGIcon` now allows specifying icon width and height in
diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatClientProperties.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatClientProperties.java
index 5a9bb722..e6c06481 100644
--- a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatClientProperties.java
+++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatClientProperties.java
@@ -371,6 +371,45 @@ public interface FlatClientProperties
*/
String TABBED_PANE_HIDDEN_TABS_NAVIGATION_ARROW_BUTTONS = "arrowButtons";
+ /**
+ * Specifies the alignment of the tab area.
+ *
+ * Component {@link javax.swing.JTabbedPane}
+ * Value type {@link java.lang.String}
+ * Allowed Values {@link #TABBED_PANE_TAB_AREA_ALIGN_LEADING} (default),
+ * {@link #TABBED_PANE_TAB_AREA_ALIGN_TRAILING}, {@link #TABBED_PANE_TAB_AREA_ALIGN_CENTER}
+ * or {@link #TABBED_PANE_TAB_AREA_ALIGN_FILL}
+ */
+ String TABBED_PANE_TAB_AREA_ALIGNMENT = "JTabbedPane.tabAreaAlignment";
+
+ /**
+ * Align the tab area to the leading edge.
+ *
+ * @see #TABBED_PANE_TAB_AREA_ALIGNMENT
+ */
+ String TABBED_PANE_TAB_AREA_ALIGN_LEADING = "leading";
+
+ /**
+ * Align the tab area to the trailing edge.
+ *
+ * @see #TABBED_PANE_TAB_AREA_ALIGNMENT
+ */
+ String TABBED_PANE_TAB_AREA_ALIGN_TRAILING = "trailing";
+
+ /**
+ * Align the tab area to center.
+ *
+ * @see #TABBED_PANE_TAB_AREA_ALIGNMENT
+ */
+ String TABBED_PANE_TAB_AREA_ALIGN_CENTER = "center";
+
+ /**
+ * Stretch tabs to fill all available space.
+ *
+ * @see #TABBED_PANE_TAB_AREA_ALIGNMENT
+ */
+ String TABBED_PANE_TAB_AREA_ALIGN_FILL = "fill";
+
/**
* Specifies a component that will be placed at the leading edge of the tabs area.
*
diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTabbedPaneUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTabbedPaneUI.java
index 1c2a8d37..228227e6 100644
--- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTabbedPaneUI.java
+++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTabbedPaneUI.java
@@ -127,6 +127,7 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault TabbedPane.tabSeparatorsFullHeight boolean
* @uiDefault TabbedPane.hasFullBorder boolean
* @uiDefault TabbedPane.hiddenTabsNavigation String moreTabsButton (default) or arrowButtons
+ * @uiDefault TabbedPane.tabAreaAlignment String leading (default), center, trailing or fill
* @uiDefault ScrollPane.smoothScrolling boolean
* @uiDefault TabbedPane.closeIcon Icon
*
@@ -141,6 +142,12 @@ public class FlatTabbedPaneUI
protected static final int MORE_TABS_BUTTON = 0;
protected static final int ARROW_BUTTONS = 1;
+ // tab area alignment
+ protected static final int ALIGN_LEADING = 0;
+ protected static final int ALIGN_TRAILING = 1;
+ protected static final int ALIGN_CENTER = 2;
+ protected static final int ALIGN_FILL = 3;
+
private static Set focusForwardTraversalKeys;
private static Set focusBackwardTraversalKeys;
@@ -166,6 +173,7 @@ public class FlatTabbedPaneUI
protected boolean tabsOpaque = true;
private String hiddenTabsNavigationStr;
+ private String tabAreaAlignmentStr;
protected Icon closeIcon;
protected String moreTabsButtonToolTipText;
@@ -232,6 +240,7 @@ public class FlatTabbedPaneUI
hasFullBorder = UIManager.getBoolean( "TabbedPane.hasFullBorder" );
tabsOpaque = UIManager.getBoolean( "TabbedPane.tabsOpaque" );
hiddenTabsNavigationStr = UIManager.getString( "TabbedPane.hiddenTabsNavigation" );
+ tabAreaAlignmentStr = UIManager.getString( "TabbedPane.tabAreaAlignment" );
closeIcon = UIManager.getIcon( "TabbedPane.closeIcon" );
Locale l = tabPane.getLocale();
@@ -548,24 +557,6 @@ public class FlatTabbedPaneUI
return Math.max( tabHeight, super.calculateTabHeight( tabPlacement, tabIndex, fontHeight ) - 2 /* was added by superclass */ );
}
- protected int calculateMaxExtrasWidth() {
- int width = 0;
- if( leadingComponent != null )
- width = Math.max( width, leadingComponent.getPreferredSize().width );
- if( trailingComponent != null )
- width = Math.max( width, trailingComponent.getPreferredSize().width );
- return width;
- }
-
- protected int calculateMaxExtrasHeight() {
- int height = 0;
- if( leadingComponent != null )
- height = Math.max( height, leadingComponent.getPreferredSize().height );
- if( trailingComponent != null )
- height = Math.max( height, trailingComponent.getPreferredSize().height );
- return height;
- }
-
@Override
protected Insets getTabInsets( int tabPlacement, int tabIndex ) {
Object value = getTabClientProperty( tabIndex, TABBED_PANE_TAB_INSETS );
@@ -579,8 +570,7 @@ public class FlatTabbedPaneUI
return new Insets( 0, 0, 0, 0 );
}
- @Override
- protected Insets getTabAreaInsets( int tabPlacement ) {
+ protected Insets getRealTabAreaInsets( int tabPlacement ) {
Insets currentTabAreaInsets = super.getTabAreaInsets( tabPlacement );
Insets insets = (Insets) currentTabAreaInsets.clone();
@@ -594,21 +584,21 @@ public class FlatTabbedPaneUI
// scale insets (before adding leading/trailing component sizes)
insets = scale( insets );
+ return insets;
+ }
+
+ @Override
+ protected Insets getTabAreaInsets( int tabPlacement ) {
+ Insets insets = getRealTabAreaInsets( tabPlacement );
+
// increase insets for wrap layout if using leading/trailing components
if( tabPane.getTabLayoutPolicy() == JTabbedPane.WRAP_TAB_LAYOUT ) {
- if( leadingComponent != null ) {
- Dimension leadingSize = leadingComponent.getPreferredSize();
- if( isHorizontalTabPlacement() )
- insets.left += leadingSize.width;
- else
- insets.top += leadingSize.height;
- }
- if( trailingComponent != null ) {
- Dimension trailingSize = trailingComponent.getPreferredSize();
- if( isHorizontalTabPlacement() )
- insets.right += trailingSize.width;
- else
- insets.bottom += trailingSize.height;
+ if( isHorizontalTabPlacement() ) {
+ insets.left += getLeadingPreferredWidth();
+ insets.right += getTrailingPreferredWidth();
+ } else {
+ insets.top += getLeadingPreferredHeight();
+ insets.bottom += getTrailingPreferredHeight();
}
}
@@ -1101,10 +1091,17 @@ public class FlatTabbedPaneUI
}
protected int getHiddenTabsNavigation() {
- String hiddenTabsNavigationStr = (String) tabPane.getClientProperty( TABBED_PANE_HIDDEN_TABS_NAVIGATION );
- if( hiddenTabsNavigationStr == null )
- hiddenTabsNavigationStr = this.hiddenTabsNavigationStr;
- return parseHiddenTabsNavigation( hiddenTabsNavigationStr );
+ String str = (String) tabPane.getClientProperty( TABBED_PANE_HIDDEN_TABS_NAVIGATION );
+ if( str == null )
+ str = hiddenTabsNavigationStr;
+ return parseHiddenTabsNavigation( str );
+ }
+
+ protected int getTabAreaAlignment() {
+ String str = (String) tabPane.getClientProperty( TABBED_PANE_TAB_AREA_ALIGNMENT );
+ if( str == null )
+ str = tabAreaAlignmentStr;
+ return parseTabAreaAlignment( str );
}
protected static int parseHiddenTabsNavigation( String str ) {
@@ -1113,8 +1110,21 @@ public class FlatTabbedPaneUI
switch( str ) {
default:
- case "moreTabsButton": return MORE_TABS_BUTTON;
- case "arrowButtons": return ARROW_BUTTONS;
+ case TABBED_PANE_HIDDEN_TABS_NAVIGATION_MORE_TABS_BUTTON: return MORE_TABS_BUTTON;
+ case TABBED_PANE_HIDDEN_TABS_NAVIGATION_ARROW_BUTTONS: return ARROW_BUTTONS;
+ }
+ }
+
+ protected static int parseTabAreaAlignment( String str ) {
+ if( str == null )
+ return ALIGN_LEADING;
+
+ switch( str ) {
+ default:
+ case TABBED_PANE_TAB_AREA_ALIGN_LEADING: return ALIGN_LEADING;
+ case TABBED_PANE_TAB_AREA_ALIGN_TRAILING: return ALIGN_TRAILING;
+ case TABBED_PANE_TAB_AREA_ALIGN_CENTER: return ALIGN_CENTER;
+ case TABBED_PANE_TAB_AREA_ALIGN_FILL: return ALIGN_FILL;
}
}
@@ -1149,6 +1159,22 @@ public class FlatTabbedPaneUI
((JComponent)tabViewport.getView()).scrollRectToVisible( (Rectangle) rects[selectedIndex].clone() );
}
+ private int getLeadingPreferredWidth() {
+ return (leadingComponent != null) ? leadingComponent.getPreferredSize().width : 0;
+ }
+
+ private int getLeadingPreferredHeight() {
+ return (leadingComponent != null) ? leadingComponent.getPreferredSize().height : 0;
+ }
+
+ private int getTrailingPreferredWidth() {
+ return (trailingComponent != null) ? trailingComponent.getPreferredSize().width : 0;
+ }
+
+ private int getTrailingPreferredHeight() {
+ return (trailingComponent != null) ? trailingComponent.getPreferredSize().height : 0;
+ }
+
private void shiftTabs( int sx, int sy ) {
if( sx == 0 && sy == 0 )
return;
@@ -1165,6 +1191,64 @@ public class FlatTabbedPaneUI
}
}
+ private void stretchTabsWidth( int sw, boolean leftToRight ) {
+ int rsw = sw / rects.length;
+ int x = rects[0].x - (leftToRight ? 0 : rsw);
+ for( int i = 0; i < rects.length; i++ ) {
+ // fix tab component location
+ Component c = tabPane.getTabComponentAt( i );
+ if( c != null )
+ c.setLocation( x + (c.getX() - rects[i].x) + (rsw / 2), c.getY() );
+
+ // fix x location and width in rects
+ rects[i].x = x;
+ rects[i].width += rsw;
+
+ if( leftToRight )
+ x += rects[i].width;
+ else if( i + 1 < rects.length )
+ x = rects[i].x - rects[i+1].width - rsw;
+ }
+
+ // fix width of last tab
+ int diff = sw - (rsw * rects.length);
+ rects[rects.length-1].width += diff;
+ if( !leftToRight )
+ rects[rects.length-1].x -= diff;
+ }
+
+ private void stretchTabsHeight( int sh ) {
+ int rsh = sh / rects.length;
+ int y = rects[0].y;
+ for( int i = 0; i < rects.length; i++ ) {
+ // fix tab component location
+ Component c = tabPane.getTabComponentAt( i );
+ if( c != null )
+ c.setLocation( c.getX(), y + (c.getY() - rects[i].y) + (rsh / 2) );
+
+ // fix y location and height in rects
+ rects[i].y = y;
+ rects[i].height += rsh;
+
+ y += rects[i].height;
+ }
+
+ // fix height of last tab
+ rects[rects.length-1].height += (sh - (rsh * rects.length));
+ }
+
+ private int rectsTotalWidth( boolean leftToRight ) {
+ int last = rects.length - 1;
+ return leftToRight
+ ? (rects[last].x + rects[last].width) - rects[0].x
+ : (rects[0].x + rects[0].width) - rects[last].x;
+ }
+
+ private int rectsTotalHeight() {
+ int last = rects.length - 1;
+ return (rects[last].y + rects[last].height) - rects[0].y;
+ }
+
//---- class TabCloseButton -----------------------------------------------
private class TabCloseButton
@@ -1796,6 +1880,7 @@ public class FlatTabbedPaneUI
case TABBED_PANE_TAB_HEIGHT:
case TABBED_PANE_TAB_INSETS:
case TABBED_PANE_HIDDEN_TABS_NAVIGATION:
+ case TABBED_PANE_TAB_AREA_ALIGNMENT:
case TABBED_PANE_TAB_CLOSABLE:
tabPane.revalidate();
tabPane.repaint();
@@ -1883,19 +1968,22 @@ public class FlatTabbedPaneUI
Rectangle bounds = tabPane.getBounds();
Insets insets = tabPane.getInsets();
int tabPlacement = tabPane.getTabPlacement();
- Insets tabAreaInsets = getTabAreaInsets( tabPlacement );
+ int tabAreaAlignment = getTabAreaAlignment();
+ Insets tabAreaInsets = getRealTabAreaInsets( tabPlacement );
boolean leftToRight = isLeftToRight();
// layout leading and trailing components in tab area
if( tabPlacement == TOP || tabPlacement == BOTTOM ) {
// fix x-locations of tabs in right-to-left component orientation
if( !leftToRight )
- shiftTabs( insets.left + tabAreaInsets.right, 0 );
+ shiftTabs( insets.left + tabAreaInsets.right + getTrailingPreferredWidth(), 0 );
// tab area height (maxTabHeight is zero if tab count is zero)
int tabAreaHeight = (maxTabHeight > 0)
? maxTabHeight
- : Math.max( calculateMaxExtrasHeight(), scale( clientPropertyInt( tabPane, TABBED_PANE_TAB_HEIGHT, tabHeight ) ) );
+ : Math.max(
+ Math.max( getLeadingPreferredHeight(), getTrailingPreferredHeight() ),
+ scale( clientPropertyInt( tabPane, TABBED_PANE_TAB_HEIGHT, tabHeight ) ) );
// tab area bounds
int tx = insets.left;
@@ -1905,38 +1993,56 @@ public class FlatTabbedPaneUI
int tw = bounds.width - insets.left - insets.right;
int th = tabAreaHeight;
+ int leadingWidth = getLeadingPreferredWidth();
+ int trailingWidth = getTrailingPreferredWidth();
+
+ // apply tab area alignment
+ if( runCount == 1 && rects.length > 0 ) {
+ int availWidth = tw - leadingWidth - trailingWidth - tabAreaInsets.left - tabAreaInsets.right;
+ int totalTabWidth = rectsTotalWidth( leftToRight );
+ int diff = availWidth - totalTabWidth;
+
+ switch( tabAreaAlignment ) {
+ case ALIGN_LEADING:
+ trailingWidth += diff;
+ break;
+
+ case ALIGN_TRAILING:
+ shiftTabs( leftToRight ? diff : -diff, 0 );
+ leadingWidth += diff;
+ break;
+
+ case ALIGN_CENTER:
+ shiftTabs( (leftToRight ? diff : -diff) / 2, 0 );
+ leadingWidth += diff / 2;
+ trailingWidth += diff - (diff / 2);
+ break;
+
+ case ALIGN_FILL:
+ stretchTabsWidth( diff, leftToRight );
+ break;
+ }
+ } else if( rects.length == 0 )
+ trailingWidth = tw - leadingWidth;
+
// layout left component
Container leftComponent = leftToRight ? leadingComponent : trailingComponent;
if( leftComponent != null ) {
- // trailing component fills all available horizontal space
- int leftWidth = leftToRight
- ? leftComponent.getPreferredSize().width
- : (rects.length > 0
- ? rects[rects.length-1].x - tx
- - (tabAreaInsets.right - trailingComponent.getPreferredSize().width)
- : tw - (leadingComponent != null ? leadingComponent.getPreferredSize().width : 0));
+ int leftWidth = leftToRight ? leadingWidth : trailingWidth;
leftComponent.setBounds( tx, ty, leftWidth, th );
-
- // reduce tab area bounds
- tx += leftWidth;
- tw -= leftWidth;
}
// layout right component
Container rightComponent = leftToRight ? trailingComponent : leadingComponent;
if( rightComponent != null ) {
- // trailing component fills all available horizontal space
- int rightWidth = !leftToRight
- ? rightComponent.getPreferredSize().width
- : (rects.length > 0
- ? tx + tw - (rects[rects.length-1].x + rects[rects.length-1].width)
- - (tabAreaInsets.right - trailingComponent.getPreferredSize().width)
- : tw);
+ int rightWidth = leftToRight ? trailingWidth : leadingWidth;
rightComponent.setBounds( tx + tw - rightWidth, ty, rightWidth, th );
}
} else { // LEFT and RIGHT tab placement
// tab area width (maxTabWidth is zero if tab count is zero)
- int tabAreaWidth = (maxTabWidth > 0) ? maxTabWidth : calculateMaxExtrasWidth();
+ int tabAreaWidth = (maxTabWidth > 0)
+ ? maxTabWidth
+ : Math.max( getLeadingPreferredWidth(), getTrailingPreferredWidth() );
// tab area bounds
int tx = (tabPlacement == LEFT)
@@ -1946,25 +2052,45 @@ public class FlatTabbedPaneUI
int tw = tabAreaWidth;
int th = bounds.height - insets.top - insets.bottom;
+ int topHeight = getLeadingPreferredHeight();
+ int bottomHeight = getTrailingPreferredHeight();
+
+ // apply tab area alignment
+ if( runCount == 1 && rects.length > 0 ) {
+ int availHeight = th - topHeight - bottomHeight - tabAreaInsets.top - tabAreaInsets.bottom;
+ int totalTabHeight = rectsTotalHeight();
+ int diff = availHeight - totalTabHeight;
+
+ switch( tabAreaAlignment ) {
+ case ALIGN_LEADING:
+ bottomHeight += diff;
+ break;
+
+ case ALIGN_TRAILING:
+ shiftTabs( 0, diff );
+ topHeight += diff;
+ break;
+
+ case ALIGN_CENTER:
+ shiftTabs( 0, (diff) / 2 );
+ topHeight += diff / 2;
+ bottomHeight += diff - (diff / 2);
+ break;
+
+ case ALIGN_FILL:
+ stretchTabsHeight( diff );
+ break;
+ }
+ } else if( rects.length == 0 )
+ bottomHeight = th - topHeight;
+
// layout top component
- if( leadingComponent != null ) {
- int topHeight = leadingComponent.getPreferredSize().height;
+ if( leadingComponent != null )
leadingComponent.setBounds( tx, ty, tw, topHeight );
- // reduce tab area bounds
- ty += topHeight;
- th -= topHeight;
- }
-
// layout bottom component
- if( trailingComponent != null ) {
- // trailing component fills all available vertical space
- int bottomHeight = (rects.length > 0)
- ? ty + th - (rects[rects.length-1].y + rects[rects.length-1].height)
- - (tabAreaInsets.bottom - trailingComponent.getPreferredSize().height)
- : th;
+ if( trailingComponent != null )
trailingComponent.setBounds( tx, ty + th - bottomHeight, tw, bottomHeight );
- }
}
}
}
@@ -2045,7 +2171,8 @@ public class FlatTabbedPaneUI
Rectangle bounds = tabPane.getBounds();
Insets insets = tabPane.getInsets();
int tabPlacement = tabPane.getTabPlacement();
- Insets tabAreaInsets = getTabAreaInsets( tabPlacement );
+ int tabAreaAlignment = getTabAreaAlignment();
+ Insets tabAreaInsets = getRealTabAreaInsets( tabPlacement );
Dimension moreButtonSize = useMoreButton ? moreTabsButton.getPreferredSize() : null;
Dimension backwardButtonSize = useMoreButton ? null : backwardButton.getPreferredSize();
Dimension forwardButtonSize = useMoreButton ? null : forwardButton.getPreferredSize();
@@ -2071,7 +2198,9 @@ public class FlatTabbedPaneUI
// tab area height (maxTabHeight is zero if tab count is zero)
int tabAreaHeight = (maxTabHeight > 0)
? maxTabHeight
- : Math.max( calculateMaxExtrasHeight(), scale( clientPropertyInt( tabPane, TABBED_PANE_TAB_HEIGHT, tabHeight ) ) );
+ : Math.max(
+ Math.max( getLeadingPreferredHeight(), getTrailingPreferredHeight() ),
+ scale( clientPropertyInt( tabPane, TABBED_PANE_TAB_HEIGHT, tabHeight ) ) );
// tab area bounds
int tx = insets.left;
@@ -2081,54 +2210,56 @@ public class FlatTabbedPaneUI
int tw = bounds.width - insets.left - insets.right;
int th = tabAreaHeight;
+ int leadingWidth = getLeadingPreferredWidth();
+ int trailingWidth = getTrailingPreferredWidth();
+ int availWidth = tw - leadingWidth - trailingWidth - tabAreaInsets.left - tabAreaInsets.right;
+ int totalTabWidth = (rects.length > 0) ? rectsTotalWidth( leftToRight ) : 0;
+
+ // apply tab area alignment
+ if( totalTabWidth < availWidth && rects.length > 0 ) {
+ int diff = availWidth - totalTabWidth;
+ switch( tabAreaAlignment ) {
+ case ALIGN_LEADING:
+ trailingWidth += diff;
+ break;
+
+ case ALIGN_TRAILING:
+ leadingWidth += diff;
+ break;
+
+ case ALIGN_CENTER:
+ leadingWidth += diff / 2;
+ trailingWidth += diff - (diff / 2);
+ break;
+
+ case ALIGN_FILL:
+ stretchTabsWidth( diff, leftToRight );
+ totalTabWidth = rectsTotalWidth( leftToRight );
+ break;
+ }
+ } else if( rects.length == 0 )
+ trailingWidth = tw - leadingWidth;
+
// layout left component
Container leftComponent = leftToRight ? leadingComponent : trailingComponent;
- if( leftComponent != null ) {
- int leftWidth = leftComponent.getPreferredSize().width;
- if( !leftToRight ) {
- // trailing component fills all available horizontal space
- int leadingWidth = (leadingComponent != null) ? leadingComponent.getPreferredSize().width : 0;
- leftWidth = Math.max( leftWidth, (rects.length > 0)
- ? tw - leadingWidth - (rects[0].x + rects[0].width - rects[rects.length-1].x)
- - (tabAreaInsets.left + tabAreaInsets.right)
- : tw - leadingWidth );
- }
+ int leftWidth = leftToRight ? leadingWidth : trailingWidth;
+ if( leftComponent != null )
leftComponent.setBounds( tx, ty, leftWidth, th );
- // reduce tab area bounds
- tx += leftWidth;
- tw -= leftWidth;
- }
-
// layout right component
Container rightComponent = leftToRight ? trailingComponent : leadingComponent;
- if( rightComponent != null ) {
- int rightWidth = rightComponent.getPreferredSize().width;
- if( leftToRight ) {
- // trailing component fills all available horizontal space
- rightWidth = Math.max( rightWidth, (rects.length > 0)
- ? tw - (rects[rects.length-1].x + rects[rects.length-1].width)
- - (tabAreaInsets.left + tabAreaInsets.right)
- : tw );
- }
+ int rightWidth = leftToRight ? trailingWidth : leadingWidth;
+ if( rightComponent != null )
rightComponent.setBounds( tx + tw - rightWidth, ty, rightWidth, th );
- // reduce tab area bounds
- tw -= rightWidth;
- }
-
// layout tab viewport and buttons
if( rects.length > 0 ) {
- int txi = tx + (leftToRight ? tabAreaInsets.left : tabAreaInsets.right);
- int twi = tw - tabAreaInsets.left - tabAreaInsets.right;
+ int txi = tx + leftWidth + (leftToRight ? tabAreaInsets.left : tabAreaInsets.right);
+ int twi = tw - leftWidth - rightWidth - tabAreaInsets.left - tabAreaInsets.right;
// layout viewport and buttons
int viewportWidth = twi;
- Rectangle lastRect = rects[rects.length - 1];
- int tabsWidth = leftToRight
- ? (lastRect.x + lastRect.width)
- : (rects[0].x + rects[0].width - lastRect.x);
- if( viewportWidth < tabsWidth ) {
+ if( viewportWidth < totalTabWidth ) {
// need buttons
buttonsVisible = true;
int buttonsWidth = useMoreButton ? moreButtonSize.width : (backwardButtonSize.width + forwardButtonSize.width);
@@ -2154,7 +2285,9 @@ public class FlatTabbedPaneUI
}
} else { // LEFT and RIGHT tab placement
// tab area width (maxTabWidth is zero if tab count is zero)
- int tabAreaWidth = (maxTabWidth > 0) ? maxTabWidth : calculateMaxExtrasWidth();
+ int tabAreaWidth = (maxTabWidth > 0)
+ ? maxTabWidth
+ : Math.max( getLeadingPreferredWidth(), getTrailingPreferredWidth() );
// tab area bounds
int tx = (tabPlacement == LEFT)
@@ -2164,40 +2297,52 @@ public class FlatTabbedPaneUI
int tw = tabAreaWidth;
int th = bounds.height - insets.top - insets.bottom;
+ int topHeight = getLeadingPreferredHeight();
+ int bottomHeight = getTrailingPreferredHeight();
+ int availHeight = th - topHeight - bottomHeight - tabAreaInsets.top - tabAreaInsets.bottom;
+ int totalTabHeight = (rects.length > 0) ? rectsTotalHeight() : 0;
+
+ // apply tab area alignment
+ if( totalTabHeight < availHeight && rects.length > 0 ) {
+ int diff = availHeight - totalTabHeight;
+ switch( tabAreaAlignment ) {
+ case ALIGN_LEADING:
+ bottomHeight += diff;
+ break;
+
+ case ALIGN_TRAILING:
+ topHeight += diff;
+ break;
+
+ case ALIGN_CENTER:
+ topHeight += diff / 2;
+ bottomHeight += diff - (diff / 2);
+ break;
+
+ case ALIGN_FILL:
+ stretchTabsHeight( diff );
+ totalTabHeight = rectsTotalHeight();
+ break;
+ }
+ } else if( rects.length == 0 )
+ bottomHeight = th - topHeight;
+
// layout top component
- if( leadingComponent != null ) {
- int topHeight = leadingComponent.getPreferredSize().height;
+ if( leadingComponent != null )
leadingComponent.setBounds( tx, ty, tw, topHeight );
- // reduce tab area bounds
- ty += topHeight;
- th -= topHeight;
- }
-
// layout bottom component
- if( trailingComponent != null ) {
- int bottomHeight = trailingComponent.getPreferredSize().height;
- // trailing component fills all available vertical space
- bottomHeight = Math.max( bottomHeight, (rects.length > 0)
- ? th - (rects[rects.length-1].y + rects[rects.length-1].height)
- - (tabAreaInsets.top + tabAreaInsets.bottom)
- : th );
+ if( trailingComponent != null )
trailingComponent.setBounds( tx, ty + th - bottomHeight, tw, bottomHeight );
- // reduce tab area bounds
- th -= bottomHeight;
- }
-
// layout tab viewport and buttons
if( rects.length > 0 ) {
- int tyi = ty + tabAreaInsets.top;
- int thi = th - tabAreaInsets.top - tabAreaInsets.bottom;
+ int tyi = ty + topHeight + tabAreaInsets.top;
+ int thi = th - topHeight - bottomHeight - tabAreaInsets.top - tabAreaInsets.bottom;
// layout viewport and buttons
int viewportHeight = thi;
- Rectangle lastRect = rects[rects.length - 1];
- int tabsHeight = lastRect.y + lastRect.height;
- if( viewportHeight < tabsHeight ) {
+ if( viewportHeight < totalTabHeight ) {
// need buttons
buttonsVisible = true;
int buttonsHeight = useMoreButton ? moreButtonSize.height : (backwardButtonSize.height + forwardButtonSize.height);
diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties
index 6a05180c..8a184861 100644
--- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties
+++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties
@@ -551,6 +551,7 @@ TabbedPane.disabledForeground=@disabledText
TabbedPane.shadow=@background
TabbedPane.contentBorderInsets=null
TabbedPane.hiddenTabsNavigation=moreTabsButton
+TabbedPane.tabAreaAlignment=leading
TabbedPane.closeIcon=com.formdev.flatlaf.icons.FlatTabbedPaneCloseIcon
TabbedPane.closeSize=16,16
diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt
index 5308a7a0..5ef5e6a6 100644
--- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt
+++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt
@@ -937,6 +937,7 @@ TabbedPane.selectedTabPadInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI
TabbedPane.selectionFollowsFocus true
TabbedPane.shadow #3c3f41 javax.swing.plaf.ColorUIResource [UI]
TabbedPane.showTabSeparators false
+TabbedPane.tabAreaAlignment leading
TabbedPane.tabAreaInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI]
TabbedPane.tabHeight 32
TabbedPane.tabInsets 4,12,4,12 javax.swing.plaf.InsetsUIResource [UI]
diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt
index df5e628a..cb2585b2 100644
--- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt
+++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt
@@ -942,6 +942,7 @@ TabbedPane.selectedTabPadInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI
TabbedPane.selectionFollowsFocus true
TabbedPane.shadow #f2f2f2 javax.swing.plaf.ColorUIResource [UI]
TabbedPane.showTabSeparators false
+TabbedPane.tabAreaAlignment leading
TabbedPane.tabAreaInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI]
TabbedPane.tabHeight 32
TabbedPane.tabInsets 4,12,4,12 javax.swing.plaf.InsetsUIResource [UI]
diff --git a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt
index aab155aa..b264f954 100644
--- a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt
+++ b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt
@@ -932,6 +932,7 @@ TabbedPane.selectedTabPadInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI
TabbedPane.selectionFollowsFocus true
TabbedPane.shadow #ccffcc javax.swing.plaf.ColorUIResource [UI]
TabbedPane.showTabSeparators false
+TabbedPane.tabAreaAlignment leading
TabbedPane.tabAreaInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI]
TabbedPane.tabHeight 32
TabbedPane.tabInsets 4,12,4,12 javax.swing.plaf.InsetsUIResource [UI]
diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.java
index dd707824..8ae1476d 100644
--- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.java
+++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.java
@@ -112,6 +112,8 @@ public class FlatContainerTest
}
customTabsChanged( tabbedPane );
+ tabBackForegroundChanged( tabbedPane );
+ setTabIcons( tabbedPane );
}
private void addTab( JTabbedPane tabbedPane ) {
@@ -154,24 +156,26 @@ public class FlatContainerTest
}
private void tabIconsChanged() {
- boolean showTabIcons = tabIconsCheckBox.isSelected();
+ setTabIcons( tabbedPane1 );
+ setTabIcons( tabbedPane2 );
+ setTabIcons( tabbedPane3 );
+ setTabIcons( tabbedPane4 );
- setTabIcons( tabbedPane1, showTabIcons );
- setTabIcons( tabbedPane2, showTabIcons );
- setTabIcons( tabbedPane3, showTabIcons );
- setTabIcons( tabbedPane4, showTabIcons );
-
- tabIconSizeSpinner.setEnabled( showTabIcons );
+ tabIconSizeSpinner.setEnabled( tabIconsCheckBox.isSelected() );
}
- private void setTabIcons( JTabbedPane tabbedPane, boolean showTabIcons ) {
+ private void setTabIcons( JTabbedPane tabbedPane ) {
+ boolean showTabIcons = tabIconsCheckBox.isSelected();
Object iconSize = tabIconSizeSpinner.getValue();
Icon icon = showTabIcons
? new ScaledImageIcon( new ImageIcon( getClass().getResource( "/com/formdev/flatlaf/testing/test" + iconSize + ".png" ) ) )
: null;
- tabbedPane.setIconAt( 0, icon );
- tabbedPane.setIconAt( 1, icon );
+ int tabCount = tabbedPane.getTabCount();
+ if( tabCount > 0 )
+ tabbedPane.setIconAt( 0, icon );
+ if( tabCount > 1 )
+ tabbedPane.setIconAt( 1, icon );
}
private void customBorderChanged() {
@@ -195,11 +199,11 @@ public class FlatContainerTest
private void customTabsChanged( JTabbedPane tabbedPane ) {
boolean customTabs = customTabsCheckBox.isSelected();
int tabCount = tabbedPane.getTabCount();
- if( tabCount >= 2 )
+ if( tabCount > 1 )
tabbedPane.setTabComponentAt( 1, customTabs ? new JButton( tabbedPane.getTitleAt( 1 ) ) : null );
- if( tabCount >= 4 )
+ if( tabCount > 3 )
tabbedPane.setTabComponentAt( 3, customTabs ? createCustomTab( tabbedPane.getTitleAt( 3 ) ) : null );
- if( tabCount >= 6 )
+ if( tabCount > 5 )
tabbedPane.setTabComponentAt( 5, customTabs ? new JCheckBox( tabbedPane.getTitleAt( 5 ) ) : null );
}
@@ -235,19 +239,33 @@ public class FlatContainerTest
}
private void hiddenTabsNavigationChanged() {
- String value = null;
- switch( (String) hiddenTabsNavigationField.getSelectedItem() ) {
- case "moreTabsButton": value = TABBED_PANE_HIDDEN_TABS_NAVIGATION_MORE_TABS_BUTTON; break;
- case "arrowButtons": value = TABBED_PANE_HIDDEN_TABS_NAVIGATION_ARROW_BUTTONS; break;
- }
-
+ String value = (String) hiddenTabsNavigationField.getSelectedItem();
+ if( "default".equals( value ) )
+ value = null;
putTabbedPanesClientProperty( TABBED_PANE_HIDDEN_TABS_NAVIGATION, value );
}
+ private void tabAreaAlignmentChanged() {
+ String value = (String) tabAreaAlignmentField.getSelectedItem();
+ if( "default".equals( value ) )
+ value = null;
+ putTabbedPanesClientProperty( TABBED_PANE_TAB_AREA_ALIGNMENT, value );
+ }
+
private void tabBackForegroundChanged() {
+ tabBackForegroundChanged( tabbedPane1 );
+ tabBackForegroundChanged( tabbedPane2 );
+ tabBackForegroundChanged( tabbedPane3 );
+ tabBackForegroundChanged( tabbedPane4 );
+ }
+
+ private void tabBackForegroundChanged( JTabbedPane tabbedPane ) {
boolean enabled = tabBackForegroundCheckBox.isSelected();
- tabbedPane1.setBackgroundAt( 0, enabled ? Color.red : null );
- tabbedPane1.setForegroundAt( 1, enabled ? Color.red : null );
+ int tabCount = tabbedPane.getTabCount();
+ if( tabCount > 0 )
+ tabbedPane.setBackgroundAt( 0, enabled ? Color.red : null );
+ if( tabCount > 1 )
+ tabbedPane.setForegroundAt( 1, enabled ? Color.red : null );
}
private void leadingComponentChanged() {
@@ -293,13 +311,15 @@ public class FlatContainerTest
JTabbedPane[] tabbedPanes = new JTabbedPane[] { tabbedPane1, tabbedPane2, tabbedPane3, tabbedPane4 };
for( JTabbedPane tabbedPane : tabbedPanes ) {
- Component c = tabbedPane.getComponentAt( 1 );
- ((JComponent)c).putClientProperty( TABBED_PANE_TAB_CLOSABLE, value );
+ if( tabbedPane.getTabCount() > 1 ) {
+ Component c = tabbedPane.getComponentAt( 1 );
+ ((JComponent)c).putClientProperty( TABBED_PANE_TAB_CLOSABLE, value );
+ }
}
}
private void tabAreaInsetsChanged() {
- UIManager.put( "TabbedPane.tabAreaInsets", tabAreaInsetsCheckBox.isSelected() ? new Insets( 10, 10, 25, 25 ) : null );
+ UIManager.put( "TabbedPane.tabAreaInsets", tabAreaInsetsCheckBox.isSelected() ? new Insets( 5, 5, 10, 10 ) : null );
FlatLaf.updateUI();
}
@@ -318,8 +338,10 @@ public class FlatContainerTest
JTabbedPane[] tabbedPanes = new JTabbedPane[] { tabbedPane1, tabbedPane2, tabbedPane3, tabbedPane4 };
for( JTabbedPane tabbedPane : tabbedPanes ) {
- Component c = tabbedPane.getComponentAt( 1 );
- ((JComponent)c).putClientProperty( TABBED_PANE_TAB_INSETS, insets );
+ if( tabbedPane.getTabCount() > 1 ) {
+ Component c = tabbedPane.getComponentAt( 1 );
+ ((JComponent)c).putClientProperty( TABBED_PANE_TAB_INSETS, insets );
+ }
}
}
@@ -363,6 +385,8 @@ public class FlatContainerTest
tabPlacementField = new JComboBox<>();
tabIconsCheckBox = new JCheckBox();
tabIconSizeSpinner = new JSpinner();
+ JLabel tabAreaAlignmentLabel = new JLabel();
+ tabAreaAlignmentField = new JComboBox<>();
tabsClosableCheckBox = new JCheckBox();
customBorderCheckBox = new JCheckBox();
tabAreaInsetsCheckBox = new JCheckBox();
@@ -488,6 +512,7 @@ public class FlatContainerTest
// rows
"[center]" +
"[]" +
+ "[]" +
"[]para" +
"[]" +
"[]para" +
@@ -560,75 +585,90 @@ public class FlatContainerTest
tabIconSizeSpinner.addChangeListener(e -> tabIconsChanged());
tabbedPaneControlPanel.add(tabIconSizeSpinner, "cell 2 2");
+ //---- tabAreaAlignmentLabel ----
+ tabAreaAlignmentLabel.setText("Tab area alignment:");
+ tabbedPaneControlPanel.add(tabAreaAlignmentLabel, "cell 0 3");
+
+ //---- tabAreaAlignmentField ----
+ tabAreaAlignmentField.setModel(new DefaultComboBoxModel<>(new String[] {
+ "default",
+ "leading",
+ "trailing",
+ "center",
+ "fill"
+ }));
+ tabAreaAlignmentField.addActionListener(e -> tabAreaAlignmentChanged());
+ tabbedPaneControlPanel.add(tabAreaAlignmentField, "cell 1 3");
+
//---- tabsClosableCheckBox ----
tabsClosableCheckBox.setText("Tabs closable");
tabsClosableCheckBox.addActionListener(e -> tabsClosableChanged());
- tabbedPaneControlPanel.add(tabsClosableCheckBox, "cell 0 3");
+ tabbedPaneControlPanel.add(tabsClosableCheckBox, "cell 0 4");
//---- customBorderCheckBox ----
customBorderCheckBox.setText("Custom border");
customBorderCheckBox.addActionListener(e -> customBorderChanged());
- tabbedPaneControlPanel.add(customBorderCheckBox, "cell 1 3");
+ tabbedPaneControlPanel.add(customBorderCheckBox, "cell 1 4");
//---- tabAreaInsetsCheckBox ----
- tabAreaInsetsCheckBox.setText("Tab area insets (10,10,25,25)");
+ tabAreaInsetsCheckBox.setText("Tab area insets (5,5,10,10)");
tabAreaInsetsCheckBox.addActionListener(e -> tabAreaInsetsChanged());
- tabbedPaneControlPanel.add(tabAreaInsetsCheckBox, "cell 2 3");
+ tabbedPaneControlPanel.add(tabAreaInsetsCheckBox, "cell 2 4");
//---- secondTabClosableCheckBox ----
secondTabClosableCheckBox.setText("Second Tab closable");
secondTabClosableCheckBox.addActionListener(e -> secondTabClosableChanged());
- tabbedPaneControlPanel.add(secondTabClosableCheckBox, "cell 0 4");
+ tabbedPaneControlPanel.add(secondTabClosableCheckBox, "cell 0 5");
//---- hasFullBorderCheckBox ----
hasFullBorderCheckBox.setText("Show content border");
hasFullBorderCheckBox.addActionListener(e -> hasFullBorderChanged());
- tabbedPaneControlPanel.add(hasFullBorderCheckBox, "cell 1 4,alignx left,growx 0");
+ 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 4");
+ tabbedPaneControlPanel.add(smallerTabHeightCheckBox, "cell 2 5");
//---- leadingComponentCheckBox ----
leadingComponentCheckBox.setText("Leading component");
leadingComponentCheckBox.addActionListener(e -> leadingComponentChanged());
- tabbedPaneControlPanel.add(leadingComponentCheckBox, "cell 0 5");
+ tabbedPaneControlPanel.add(leadingComponentCheckBox, "cell 0 6");
//---- hideContentSeparatorCheckBox ----
hideContentSeparatorCheckBox.setText("Hide content separator");
hideContentSeparatorCheckBox.addActionListener(e -> hideContentSeparatorChanged());
- tabbedPaneControlPanel.add(hideContentSeparatorCheckBox, "cell 1 5");
+ tabbedPaneControlPanel.add(hideContentSeparatorCheckBox, "cell 1 6");
//---- smallerInsetsCheckBox ----
smallerInsetsCheckBox.setText("Smaller tab insets (2,2,2,2)");
smallerInsetsCheckBox.addActionListener(e -> smallerInsetsChanged());
- tabbedPaneControlPanel.add(smallerInsetsCheckBox, "cell 2 5");
+ tabbedPaneControlPanel.add(smallerInsetsCheckBox, "cell 2 6");
//---- trailingComponentCheckBox ----
trailingComponentCheckBox.setText("Trailing component");
trailingComponentCheckBox.addActionListener(e -> trailingComponentChanged());
- tabbedPaneControlPanel.add(trailingComponentCheckBox, "cell 0 6");
+ tabbedPaneControlPanel.add(trailingComponentCheckBox, "cell 0 7");
//---- showTabSeparatorsCheckBox ----
showTabSeparatorsCheckBox.setText("Show tab separators");
showTabSeparatorsCheckBox.addActionListener(e -> showTabSeparatorsChanged());
- tabbedPaneControlPanel.add(showTabSeparatorsCheckBox, "cell 1 6");
+ tabbedPaneControlPanel.add(showTabSeparatorsCheckBox, "cell 1 7");
//---- secondTabWiderCheckBox ----
secondTabWiderCheckBox.setText("Second Tab insets wider (4,20,4,20)");
secondTabWiderCheckBox.addActionListener(e -> secondTabWiderChanged());
- tabbedPaneControlPanel.add(secondTabWiderCheckBox, "cell 2 6");
+ tabbedPaneControlPanel.add(secondTabWiderCheckBox, "cell 2 7");
//---- minimumTabWidthCheckBox ----
minimumTabWidthCheckBox.setText("Minimum tab width (100)");
minimumTabWidthCheckBox.addActionListener(e -> minimumTabWidthChanged());
- tabbedPaneControlPanel.add(minimumTabWidthCheckBox, "cell 2 7");
+ tabbedPaneControlPanel.add(minimumTabWidthCheckBox, "cell 2 8");
//---- maximumTabWidthCheckBox ----
maximumTabWidthCheckBox.setText("Maximum tab width (60)");
maximumTabWidthCheckBox.addActionListener(e -> maximumTabWidthChanged());
- tabbedPaneControlPanel.add(maximumTabWidthCheckBox, "cell 2 8");
+ tabbedPaneControlPanel.add(maximumTabWidthCheckBox, "cell 2 9");
}
panel9.add(tabbedPaneControlPanel, cc.xywh(1, 11, 3, 1));
}
@@ -649,6 +689,7 @@ public class FlatContainerTest
private JComboBox tabPlacementField;
private JCheckBox tabIconsCheckBox;
private JSpinner tabIconSizeSpinner;
+ private JComboBox tabAreaAlignmentField;
private JCheckBox tabsClosableCheckBox;
private JCheckBox customBorderCheckBox;
private JCheckBox tabAreaInsetsCheckBox;
diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.jfd
index 0f7cb0c5..68b6614b 100644
--- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.jfd
+++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.jfd
@@ -132,7 +132,7 @@ new FormModel {
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestFrame$NoRightToLeftPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 0,hidemode 3"
"$columnConstraints": "[][fill][]"
- "$rowConstraints": "[center][][]para[][]para[][]para[][]"
+ "$rowConstraints": "[center][][][]para[][]para[][]para[][]"
} ) {
name: "tabbedPaneControlPanel"
"opaque": false
@@ -261,6 +261,30 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 2"
} )
+ add( new FormComponent( "javax.swing.JLabel" ) {
+ name: "tabAreaAlignmentLabel"
+ "text": "Tab area alignment:"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 3"
+ } )
+ add( new FormComponent( "javax.swing.JComboBox" ) {
+ name: "tabAreaAlignmentField"
+ "model": new javax.swing.DefaultComboBoxModel {
+ selectedItem: "default"
+ addElement( "default" )
+ addElement( "leading" )
+ addElement( "trailing" )
+ addElement( "center" )
+ addElement( "fill" )
+ }
+ auxiliary() {
+ "JavaCodeGenerator.variableLocal": false
+ "JavaCodeGenerator.typeParameters": "String"
+ }
+ addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabAreaAlignmentChanged", false ) )
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 1 3"
+ } )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "tabsClosableCheckBox"
"text": "Tabs closable"
@@ -269,7 +293,7 @@ new FormModel {
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabsClosableChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
- "value": "cell 0 3"
+ "value": "cell 0 4"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "customBorderCheckBox"
@@ -279,17 +303,17 @@ new FormModel {
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "customBorderChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
- "value": "cell 1 3"
+ "value": "cell 1 4"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "tabAreaInsetsCheckBox"
- "text": "Tab area insets (10,10,25,25)"
+ "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 3"
+ "value": "cell 2 4"
} )
add( new FormComponent( "com.formdev.flatlaf.extras.TriStateCheckBox" ) {
name: "secondTabClosableCheckBox"
@@ -299,7 +323,7 @@ new FormModel {
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "secondTabClosableChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
- "value": "cell 0 4"
+ "value": "cell 0 5"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "hasFullBorderCheckBox"
@@ -309,7 +333,7 @@ new FormModel {
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hasFullBorderChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
- "value": "cell 1 4,alignx left,growx 0"
+ "value": "cell 1 5,alignx left,growx 0"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "smallerTabHeightCheckBox"
@@ -319,7 +343,7 @@ new FormModel {
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "smallerTabHeightChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
- "value": "cell 2 4"
+ "value": "cell 2 5"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "leadingComponentCheckBox"
@@ -329,7 +353,7 @@ new FormModel {
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "leadingComponentChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
- "value": "cell 0 5"
+ "value": "cell 0 6"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "hideContentSeparatorCheckBox"
@@ -339,7 +363,7 @@ new FormModel {
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hideContentSeparatorChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
- "value": "cell 1 5"
+ "value": "cell 1 6"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "smallerInsetsCheckBox"
@@ -349,7 +373,7 @@ new FormModel {
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "smallerInsetsChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
- "value": "cell 2 5"
+ "value": "cell 2 6"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "trailingComponentCheckBox"
@@ -359,7 +383,7 @@ new FormModel {
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "trailingComponentChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
- "value": "cell 0 6"
+ "value": "cell 0 7"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "showTabSeparatorsCheckBox"
@@ -369,7 +393,7 @@ new FormModel {
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showTabSeparatorsChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
- "value": "cell 1 6"
+ "value": "cell 1 7"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "secondTabWiderCheckBox"
@@ -379,7 +403,7 @@ new FormModel {
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "secondTabWiderChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
- "value": "cell 2 6"
+ "value": "cell 2 7"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "minimumTabWidthCheckBox"
@@ -389,7 +413,7 @@ new FormModel {
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "minimumTabWidthChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
- "value": "cell 2 7"
+ "value": "cell 2 8"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "maximumTabWidthCheckBox"
@@ -399,7 +423,7 @@ new FormModel {
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "maximumTabWidthChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
- "value": "cell 2 8"
+ "value": "cell 2 9"
} )
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
"gridY": 11
@@ -410,7 +434,7 @@ new FormModel {
} )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 )
- "size": new java.awt.Dimension( 810, 745 )
+ "size": new java.awt.Dimension( 810, 860 )
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "hidemode 3,align center center"
@@ -440,7 +464,7 @@ new FormModel {
"value": "cell 2 0"
} )
}, new FormLayoutConstraints( null ) {
- "location": new java.awt.Point( 0, 790 )
+ "location": new java.awt.Point( 0, 890 )
"size": new java.awt.Dimension( 291, 118 )
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
@@ -465,7 +489,7 @@ new FormModel {
"value": "cell 1 0"
} )
}, new FormLayoutConstraints( null ) {
- "location": new java.awt.Point( 340, 790 )
+ "location": new java.awt.Point( 340, 890 )
"size": new java.awt.Dimension( 291, 118 )
} )
}
diff --git a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt
index c6c01066..52c3803d 100644
--- a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt
+++ b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt
@@ -667,6 +667,7 @@ TabbedPane.selectedTabPadInsets
TabbedPane.selectionFollowsFocus
TabbedPane.shadow
TabbedPane.showTabSeparators
+TabbedPane.tabAreaAlignment
TabbedPane.tabAreaInsets
TabbedPane.tabHeight
TabbedPane.tabInsets