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 95023fad..212fd9ec 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 @@ -875,42 +875,10 @@ public class FlatTabbedPaneUI } protected void paintTabSelection( Graphics g, int tabPlacement, int x, int y, int w, int h ) { - // increase clip bounds in scroll-tab-layout to paint over the separator line - Rectangle clipBounds = isScrollTabLayout() ? g.getClipBounds() : null; - if( clipBounds != null && - this.contentSeparatorHeight != 0 && - clientPropertyBoolean( tabPane, TABBED_PANE_SHOW_CONTENT_SEPARATOR, true ) ) - { - Rectangle newClipBounds = new Rectangle( clipBounds ); - int contentSeparatorHeight = scale( this.contentSeparatorHeight ); - switch( tabPlacement ) { - case TOP: - default: - newClipBounds.height += contentSeparatorHeight; - break; - - case BOTTOM: - newClipBounds.y -= contentSeparatorHeight; - newClipBounds.height += contentSeparatorHeight; - break; - - case LEFT: - newClipBounds.width += contentSeparatorHeight; - break; - - case RIGHT: - newClipBounds.x -= contentSeparatorHeight; - newClipBounds.width += contentSeparatorHeight; - break; - } - g.setClip( newClipBounds ); - } - g.setColor( tabPane.isEnabled() ? underlineColor : disabledUnderlineColor ); - Insets contentInsets = getContentBorderInsets( tabPlacement ); - // paint underline selection + Insets contentInsets = getContentBorderInsets( tabPlacement ); int tabSelectionHeight = scale( this.tabSelectionHeight ); switch( tabPlacement ) { case TOP: @@ -932,9 +900,6 @@ public class FlatTabbedPaneUI g.fillRect( x - contentInsets.right, y, tabSelectionHeight, h ); break; } - - if( clipBounds != null ) - g.setClip( clipBounds ); } /** @@ -1005,8 +970,15 @@ public class FlatTabbedPaneUI if( isScrollTabLayout() && selectedIndex >= 0 && tabViewport != null ) { Rectangle tabRect = getTabBounds( tabPane, selectedIndex ); + // clip to "scrolling sides" of viewport + // (left and right if horizontal, top and bottom if vertical) Shape oldClip = g.getClip(); - g.setClip( tabViewport.getBounds() ); + Rectangle vr = tabViewport.getBounds(); + if( isHorizontalTabPlacement() ) + g.clipRect( vr.x, 0, vr.width, tabPane.getHeight() ); + else + g.clipRect( 0, vr.y, tabPane.getWidth(), vr.height ); + paintTabSelection( g, tabPlacement, tabRect.x, tabRect.y, tabRect.width, tabRect.height ); g.setClip( oldClip ); } 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 b264f954..1c29e8dd 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt @@ -551,7 +551,7 @@ MenuItem.textAcceleratorGap 24 MenuItem.textNoAcceleratorGap 6 MenuItem.underlineSelectionBackground #e6e6e6 javax.swing.plaf.ColorUIResource [UI] MenuItem.underlineSelectionCheckBackground #ccccff javax.swing.plaf.ColorUIResource [UI] -MenuItem.underlineSelectionColor #4a88c7 javax.swing.plaf.ColorUIResource [UI] +MenuItem.underlineSelectionColor #ffff00 javax.swing.plaf.ColorUIResource [UI] MenuItem.underlineSelectionHeight 3 @@ -909,7 +909,7 @@ TabbedPane.closeIcon [lazy] 16,16 com.formdev.flatlaf.icons.FlatTab TabbedPane.closePressedBackground #00ff00 javax.swing.plaf.ColorUIResource [UI] TabbedPane.closePressedForeground #000000 javax.swing.plaf.ColorUIResource [UI] TabbedPane.closeSize 16,16 javax.swing.plaf.DimensionUIResource [UI] -TabbedPane.contentAreaColor #bbbbbb javax.swing.plaf.ColorUIResource [UI] +TabbedPane.contentAreaColor #ff0000 javax.swing.plaf.ColorUIResource [UI] TabbedPane.contentOpaque true TabbedPane.contentSeparatorHeight 1 TabbedPane.darkShadow #696969 javax.swing.plaf.ColorUIResource [UI] @@ -943,7 +943,7 @@ TabbedPane.tabSeparatorsFullHeight false TabbedPane.tabsOpaque true TabbedPane.tabsOverlapBorder false TabbedPane.textIconGap 4 -TabbedPane.underlineColor #4a88c7 javax.swing.plaf.ColorUIResource [UI] +TabbedPane.underlineColor #ffff00 javax.swing.plaf.ColorUIResource [UI] TabbedPaneUI com.formdev.flatlaf.ui.FlatTabbedPaneUI @@ -1138,7 +1138,7 @@ ToggleButton.tab.disabledUnderlineColor #7a7a7a javax.swing.plaf.ColorUIResou ToggleButton.tab.focusBackground #dddddd javax.swing.plaf.ColorUIResource [UI] ToggleButton.tab.hoverBackground #eeeeee javax.swing.plaf.ColorUIResource [UI] ToggleButton.tab.selectedBackground #00ff00 javax.swing.plaf.ColorUIResource [UI] -ToggleButton.tab.underlineColor #4a88c7 javax.swing.plaf.ColorUIResource [UI] +ToggleButton.tab.underlineColor #ffff00 javax.swing.plaf.ColorUIResource [UI] ToggleButton.tab.underlineHeight 2 ToggleButton.textIconGap 4 ToggleButton.textShiftOffset 0 diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/FlatTestLaf.properties b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/FlatTestLaf.properties index e508b905..109fb330 100644 --- a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/FlatTestLaf.properties +++ b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/FlatTestLaf.properties @@ -277,12 +277,12 @@ SplitPaneDivider.oneTouchHoverArrowColor=#f00 TabbedPane.disabledForeground=#777 TabbedPane.selectedBackground=#0f0 TabbedPane.selectedForeground=#00f -TabbedPane.underlineColor=#4A88C7 +TabbedPane.underlineColor=#ff0 TabbedPane.disabledUnderlineColor=#7a7a7a TabbedPane.hoverColor=#eee TabbedPane.focusColor=#ddd TabbedPane.tabSeparatorColor=#00f -TabbedPane.contentAreaColor=#bbb +TabbedPane.contentAreaColor=#f00 TabbedPane.closeSize=16,16 TabbedPane.closeArc=999