mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 23:37:13 -06:00
TabbedPane: fixed clipping when painting tab selection in scroll layout
This commit is contained in:
@@ -875,42 +875,10 @@ public class FlatTabbedPaneUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void paintTabSelection( Graphics g, int tabPlacement, int x, int y, int w, int h ) {
|
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 );
|
g.setColor( tabPane.isEnabled() ? underlineColor : disabledUnderlineColor );
|
||||||
|
|
||||||
Insets contentInsets = getContentBorderInsets( tabPlacement );
|
|
||||||
|
|
||||||
// paint underline selection
|
// paint underline selection
|
||||||
|
Insets contentInsets = getContentBorderInsets( tabPlacement );
|
||||||
int tabSelectionHeight = scale( this.tabSelectionHeight );
|
int tabSelectionHeight = scale( this.tabSelectionHeight );
|
||||||
switch( tabPlacement ) {
|
switch( tabPlacement ) {
|
||||||
case TOP:
|
case TOP:
|
||||||
@@ -932,9 +900,6 @@ public class FlatTabbedPaneUI
|
|||||||
g.fillRect( x - contentInsets.right, y, tabSelectionHeight, h );
|
g.fillRect( x - contentInsets.right, y, tabSelectionHeight, h );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( clipBounds != null )
|
|
||||||
g.setClip( clipBounds );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1005,8 +970,15 @@ public class FlatTabbedPaneUI
|
|||||||
if( isScrollTabLayout() && selectedIndex >= 0 && tabViewport != null ) {
|
if( isScrollTabLayout() && selectedIndex >= 0 && tabViewport != null ) {
|
||||||
Rectangle tabRect = getTabBounds( tabPane, selectedIndex );
|
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();
|
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 );
|
paintTabSelection( g, tabPlacement, tabRect.x, tabRect.y, tabRect.width, tabRect.height );
|
||||||
g.setClip( oldClip );
|
g.setClip( oldClip );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -551,7 +551,7 @@ MenuItem.textAcceleratorGap 24
|
|||||||
MenuItem.textNoAcceleratorGap 6
|
MenuItem.textNoAcceleratorGap 6
|
||||||
MenuItem.underlineSelectionBackground #e6e6e6 javax.swing.plaf.ColorUIResource [UI]
|
MenuItem.underlineSelectionBackground #e6e6e6 javax.swing.plaf.ColorUIResource [UI]
|
||||||
MenuItem.underlineSelectionCheckBackground #ccccff 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
|
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.closePressedBackground #00ff00 javax.swing.plaf.ColorUIResource [UI]
|
||||||
TabbedPane.closePressedForeground #000000 javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.closePressedForeground #000000 javax.swing.plaf.ColorUIResource [UI]
|
||||||
TabbedPane.closeSize 16,16 javax.swing.plaf.DimensionUIResource [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.contentOpaque true
|
||||||
TabbedPane.contentSeparatorHeight 1
|
TabbedPane.contentSeparatorHeight 1
|
||||||
TabbedPane.darkShadow #696969 javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.darkShadow #696969 javax.swing.plaf.ColorUIResource [UI]
|
||||||
@@ -943,7 +943,7 @@ TabbedPane.tabSeparatorsFullHeight false
|
|||||||
TabbedPane.tabsOpaque true
|
TabbedPane.tabsOpaque true
|
||||||
TabbedPane.tabsOverlapBorder false
|
TabbedPane.tabsOverlapBorder false
|
||||||
TabbedPane.textIconGap 4
|
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
|
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.focusBackground #dddddd javax.swing.plaf.ColorUIResource [UI]
|
||||||
ToggleButton.tab.hoverBackground #eeeeee 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.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.tab.underlineHeight 2
|
||||||
ToggleButton.textIconGap 4
|
ToggleButton.textIconGap 4
|
||||||
ToggleButton.textShiftOffset 0
|
ToggleButton.textShiftOffset 0
|
||||||
|
|||||||
@@ -277,12 +277,12 @@ SplitPaneDivider.oneTouchHoverArrowColor=#f00
|
|||||||
TabbedPane.disabledForeground=#777
|
TabbedPane.disabledForeground=#777
|
||||||
TabbedPane.selectedBackground=#0f0
|
TabbedPane.selectedBackground=#0f0
|
||||||
TabbedPane.selectedForeground=#00f
|
TabbedPane.selectedForeground=#00f
|
||||||
TabbedPane.underlineColor=#4A88C7
|
TabbedPane.underlineColor=#ff0
|
||||||
TabbedPane.disabledUnderlineColor=#7a7a7a
|
TabbedPane.disabledUnderlineColor=#7a7a7a
|
||||||
TabbedPane.hoverColor=#eee
|
TabbedPane.hoverColor=#eee
|
||||||
TabbedPane.focusColor=#ddd
|
TabbedPane.focusColor=#ddd
|
||||||
TabbedPane.tabSeparatorColor=#00f
|
TabbedPane.tabSeparatorColor=#00f
|
||||||
TabbedPane.contentAreaColor=#bbb
|
TabbedPane.contentAreaColor=#f00
|
||||||
|
|
||||||
TabbedPane.closeSize=16,16
|
TabbedPane.closeSize=16,16
|
||||||
TabbedPane.closeArc=999
|
TabbedPane.closeArc=999
|
||||||
|
|||||||
Reference in New Issue
Block a user