mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
TabbedPane:
- use rounded rectangles for buttons in tab area - "pressed" background for buttons in tab area - fill background of buttons in tab area - use derived colors for hover and pressed - fixed missing arrow in "more tabs" button at larger scaling
This commit is contained in:
@@ -68,13 +68,14 @@ public class FlatTabbedPaneCloseIcon
|
|||||||
// paint background
|
// paint background
|
||||||
Color bg = FlatButtonUI.buttonStateColor( c, background, null, null, hoverBackground, pressedBackground );
|
Color bg = FlatButtonUI.buttonStateColor( c, background, null, null, hoverBackground, pressedBackground );
|
||||||
if( bg != null ) {
|
if( bg != null ) {
|
||||||
g.setColor( bg );
|
g.setColor( FlatUIUtils.deriveColor( bg, c.getBackground() ) );
|
||||||
g.fillRoundRect( (width - size.width) / 2, (height - size.height) / 2,
|
g.fillRoundRect( (width - size.width) / 2, (height - size.height) / 2,
|
||||||
size.width, size.height, arc, arc );
|
size.width, size.height, arc, arc );
|
||||||
}
|
}
|
||||||
|
|
||||||
// set cross color
|
// set cross color
|
||||||
g.setColor( FlatButtonUI.buttonStateColor( c, foreground, null, null, hoverForeground, pressedForeground ) );
|
Color fg = FlatButtonUI.buttonStateColor( c, foreground, null, null, hoverForeground, pressedForeground );
|
||||||
|
g.setColor( FlatUIUtils.deriveColor( fg, c.getForeground() ) );
|
||||||
|
|
||||||
float mx = width / 2;
|
float mx = width / 2;
|
||||||
float my = height / 2;
|
float my = height / 2;
|
||||||
|
|||||||
@@ -42,12 +42,13 @@ public class FlatArrowButton
|
|||||||
{
|
{
|
||||||
public static final int DEFAULT_ARROW_WIDTH = 8;
|
public static final int DEFAULT_ARROW_WIDTH = 8;
|
||||||
|
|
||||||
private final boolean chevron;
|
protected final boolean chevron;
|
||||||
private final Color foreground;
|
protected final Color foreground;
|
||||||
private final Color disabledForeground;
|
protected final Color disabledForeground;
|
||||||
private final Color hoverForeground;
|
protected final Color hoverForeground;
|
||||||
private final Color hoverBackground;
|
protected final Color hoverBackground;
|
||||||
private final Color pressedBackground;
|
protected final Color pressedForeground;
|
||||||
|
protected final Color pressedBackground;
|
||||||
|
|
||||||
private int arrowWidth = DEFAULT_ARROW_WIDTH;
|
private int arrowWidth = DEFAULT_ARROW_WIDTH;
|
||||||
private int xOffset = 0;
|
private int xOffset = 0;
|
||||||
@@ -64,6 +65,12 @@ public class FlatArrowButton
|
|||||||
|
|
||||||
public FlatArrowButton( int direction, String type, Color foreground, Color disabledForeground,
|
public FlatArrowButton( int direction, String type, Color foreground, Color disabledForeground,
|
||||||
Color hoverForeground, Color hoverBackground, Color pressedBackground )
|
Color hoverForeground, Color hoverBackground, Color pressedBackground )
|
||||||
|
{
|
||||||
|
this( direction, type, foreground, disabledForeground, hoverForeground, hoverBackground, null, pressedBackground );
|
||||||
|
}
|
||||||
|
|
||||||
|
public FlatArrowButton( int direction, String type, Color foreground, Color disabledForeground,
|
||||||
|
Color hoverForeground, Color hoverBackground, Color pressedForeground, Color pressedBackground )
|
||||||
{
|
{
|
||||||
super( direction, Color.WHITE, Color.WHITE, Color.WHITE, Color.WHITE );
|
super( direction, Color.WHITE, Color.WHITE, Color.WHITE, Color.WHITE );
|
||||||
|
|
||||||
@@ -72,6 +79,7 @@ public class FlatArrowButton
|
|||||||
this.disabledForeground = disabledForeground;
|
this.disabledForeground = disabledForeground;
|
||||||
this.hoverForeground = hoverForeground;
|
this.hoverForeground = hoverForeground;
|
||||||
this.hoverBackground = hoverBackground;
|
this.hoverBackground = hoverBackground;
|
||||||
|
this.pressedForeground = pressedForeground;
|
||||||
this.pressedBackground = pressedBackground;
|
this.pressedBackground = pressedBackground;
|
||||||
|
|
||||||
setOpaque( false );
|
setOpaque( false );
|
||||||
@@ -142,6 +150,10 @@ public class FlatArrowButton
|
|||||||
return background;
|
return background;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Color deriveForeground( Color foreground ) {
|
||||||
|
return foreground;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dimension getPreferredSize() {
|
public Dimension getPreferredSize() {
|
||||||
return scale( super.getPreferredSize() );
|
return scale( super.getPreferredSize() );
|
||||||
@@ -157,24 +169,36 @@ public class FlatArrowButton
|
|||||||
Graphics2D g2 = (Graphics2D)g;
|
Graphics2D g2 = (Graphics2D)g;
|
||||||
FlatUIUtils.setRenderingHints( g2 );
|
FlatUIUtils.setRenderingHints( g2 );
|
||||||
|
|
||||||
int width = getWidth();
|
|
||||||
int height = getHeight();
|
|
||||||
boolean enabled = isEnabled();
|
|
||||||
|
|
||||||
// paint hover or pressed background
|
// paint hover or pressed background
|
||||||
if( enabled ) {
|
if( isEnabled() ) {
|
||||||
Color background = (pressedBackground != null && isPressed())
|
Color background = (pressedBackground != null && isPressed())
|
||||||
? deriveBackground( pressedBackground )
|
? pressedBackground
|
||||||
: ((hoverBackground != null && isHover())
|
: (hoverBackground != null && isHover()
|
||||||
? deriveBackground( hoverBackground )
|
? hoverBackground
|
||||||
: null);
|
: null);
|
||||||
|
|
||||||
if( background != null ) {
|
if( background != null ) {
|
||||||
g.setColor( background );
|
g.setColor( deriveBackground( background ) );
|
||||||
g.fillRect( 0, 0, width, height );
|
paintBackground( g2 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// paint arrow
|
||||||
|
g.setColor( deriveForeground( isEnabled()
|
||||||
|
? (pressedForeground != null && isPressed()
|
||||||
|
? pressedForeground
|
||||||
|
: (hoverForeground != null && isHover()
|
||||||
|
? hoverForeground
|
||||||
|
: foreground))
|
||||||
|
: disabledForeground ) );
|
||||||
|
paintArrow( g2 );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void paintBackground( Graphics2D g ) {
|
||||||
|
g.fillRect( 0, 0, getWidth(), getHeight() );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void paintArrow( Graphics2D g ) {
|
||||||
int direction = getDirection();
|
int direction = getDirection();
|
||||||
boolean vert = (direction == NORTH || direction == SOUTH);
|
boolean vert = (direction == NORTH || direction == SOUTH);
|
||||||
|
|
||||||
@@ -193,8 +217,8 @@ public class FlatArrowButton
|
|||||||
rh++;
|
rh++;
|
||||||
}
|
}
|
||||||
|
|
||||||
int x = Math.round( (width - rw) / 2f + scale( (float) xOffset ) );
|
int x = Math.round( (getWidth() - rw) / 2f + scale( (float) xOffset ) );
|
||||||
int y = Math.round( (height - rh) / 2f + scale( (float) yOffset ) );
|
int y = Math.round( (getHeight() - rh) / 2f + scale( (float) yOffset ) );
|
||||||
|
|
||||||
// move arrow for round borders
|
// move arrow for round borders
|
||||||
Container parent = getParent();
|
Container parent = getParent();
|
||||||
@@ -202,20 +226,17 @@ public class FlatArrowButton
|
|||||||
x -= scale( parent.getComponentOrientation().isLeftToRight() ? 1 : -1 );
|
x -= scale( parent.getComponentOrientation().isLeftToRight() ? 1 : -1 );
|
||||||
|
|
||||||
// paint arrow
|
// paint arrow
|
||||||
g.setColor( enabled
|
|
||||||
? (isHover() && hoverForeground != null ? hoverForeground : foreground)
|
|
||||||
: disabledForeground );
|
|
||||||
g.translate( x, y );
|
g.translate( x, y );
|
||||||
/*debug
|
/*debug
|
||||||
debugPaint( g2, vert, rw, rh );
|
debugPaint( g, vert, rw, rh );
|
||||||
debug*/
|
debug*/
|
||||||
Shape arrowShape = createArrowShape( direction, chevron, w, h );
|
Shape arrowShape = createArrowShape( direction, chevron, w, h );
|
||||||
if( chevron ) {
|
if( chevron ) {
|
||||||
g2.setStroke( new BasicStroke( scale( 1f ) ) );
|
g.setStroke( new BasicStroke( scale( 1f ) ) );
|
||||||
g2.draw( arrowShape );
|
g.draw( arrowShape );
|
||||||
} else {
|
} else {
|
||||||
// triangle
|
// triangle
|
||||||
g2.fill( arrowShape );
|
g.fill( arrowShape );
|
||||||
}
|
}
|
||||||
g.translate( -x, -y );
|
g.translate( -x, -y );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,6 @@ import com.formdev.flatlaf.util.UIScale;
|
|||||||
*
|
*
|
||||||
* <!-- FlatTabbedPaneUI -->
|
* <!-- FlatTabbedPaneUI -->
|
||||||
*
|
*
|
||||||
* @uiDefault TabbedPane.arrowType String chevron (default) or triangle
|
|
||||||
* @uiDefault TabbedPane.disabledForeground Color
|
* @uiDefault TabbedPane.disabledForeground Color
|
||||||
* @uiDefault TabbedPane.selectedBackground Color optional
|
* @uiDefault TabbedPane.selectedBackground Color optional
|
||||||
* @uiDefault TabbedPane.selectedForeground Color
|
* @uiDefault TabbedPane.selectedForeground Color
|
||||||
@@ -133,6 +132,12 @@ import com.formdev.flatlaf.util.UIScale;
|
|||||||
* @uiDefault ScrollPane.smoothScrolling boolean
|
* @uiDefault ScrollPane.smoothScrolling boolean
|
||||||
* @uiDefault TabbedPane.closeIcon Icon
|
* @uiDefault TabbedPane.closeIcon Icon
|
||||||
*
|
*
|
||||||
|
* @uiDefault TabbedPane.arrowType String chevron (default) or triangle
|
||||||
|
* @uiDefault TabbedPane.buttonInsets Insets
|
||||||
|
* @uiDefault TabbedPane.buttonArc int
|
||||||
|
* @uiDefault TabbedPane.buttonHoverBackground Color
|
||||||
|
* @uiDefault TabbedPane.buttonPressedBackground Color
|
||||||
|
*
|
||||||
* @uiDefault TabbedPane.moreTabsButtonToolTipText String
|
* @uiDefault TabbedPane.moreTabsButtonToolTipText String
|
||||||
*
|
*
|
||||||
* @author Karl Tauber
|
* @author Karl Tauber
|
||||||
@@ -154,6 +159,7 @@ public class FlatTabbedPaneUI
|
|||||||
private static Set<KeyStroke> focusForwardTraversalKeys;
|
private static Set<KeyStroke> focusForwardTraversalKeys;
|
||||||
private static Set<KeyStroke> focusBackwardTraversalKeys;
|
private static Set<KeyStroke> focusBackwardTraversalKeys;
|
||||||
|
|
||||||
|
protected Color foreground;
|
||||||
protected Color disabledForeground;
|
protected Color disabledForeground;
|
||||||
protected Color selectedBackground;
|
protected Color selectedBackground;
|
||||||
protected Color selectedForeground;
|
protected Color selectedForeground;
|
||||||
@@ -181,6 +187,12 @@ public class FlatTabbedPaneUI
|
|||||||
private String tabWidthModeStr;
|
private String tabWidthModeStr;
|
||||||
protected Icon closeIcon;
|
protected Icon closeIcon;
|
||||||
|
|
||||||
|
protected String arrowType;
|
||||||
|
protected Insets buttonInsets;
|
||||||
|
protected int buttonArc;
|
||||||
|
protected Color buttonHoverBackground;
|
||||||
|
protected Color buttonPressedBackground;
|
||||||
|
|
||||||
protected String moreTabsButtonToolTipText;
|
protected String moreTabsButtonToolTipText;
|
||||||
|
|
||||||
protected JViewport tabViewport;
|
protected JViewport tabViewport;
|
||||||
@@ -200,6 +212,19 @@ public class FlatTabbedPaneUI
|
|||||||
return new FlatTabbedPaneUI();
|
return new FlatTabbedPaneUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void installUI( JComponent c ) {
|
||||||
|
// initialize this defaults here because they are used in constructor
|
||||||
|
// of FlatTabAreaButton, which is invoked before installDefaults()
|
||||||
|
arrowType = UIManager.getString( "TabbedPane.arrowType" );
|
||||||
|
foreground = UIManager.getColor( "TabbedPane.foreground" );
|
||||||
|
disabledForeground = UIManager.getColor( "TabbedPane.disabledForeground" );
|
||||||
|
buttonHoverBackground = UIManager.getColor( "TabbedPane.buttonHoverBackground" );
|
||||||
|
buttonPressedBackground = UIManager.getColor( "TabbedPane.buttonPressedBackground" );
|
||||||
|
|
||||||
|
super.installUI( c );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void installDefaults() {
|
protected void installDefaults() {
|
||||||
if( UIManager.getBoolean( "TabbedPane.tabsOverlapBorder" ) ) {
|
if( UIManager.getBoolean( "TabbedPane.tabsOverlapBorder" ) ) {
|
||||||
@@ -224,7 +249,6 @@ public class FlatTabbedPaneUI
|
|||||||
} else
|
} else
|
||||||
super.installDefaults();
|
super.installDefaults();
|
||||||
|
|
||||||
disabledForeground = UIManager.getColor( "TabbedPane.disabledForeground" );
|
|
||||||
selectedBackground = UIManager.getColor( "TabbedPane.selectedBackground" );
|
selectedBackground = UIManager.getColor( "TabbedPane.selectedBackground" );
|
||||||
selectedForeground = UIManager.getColor( "TabbedPane.selectedForeground" );
|
selectedForeground = UIManager.getColor( "TabbedPane.selectedForeground" );
|
||||||
underlineColor = UIManager.getColor( "TabbedPane.underlineColor" );
|
underlineColor = UIManager.getColor( "TabbedPane.underlineColor" );
|
||||||
@@ -250,6 +274,9 @@ public class FlatTabbedPaneUI
|
|||||||
tabWidthModeStr = UIManager.getString( "TabbedPane.tabWidthMode" );
|
tabWidthModeStr = UIManager.getString( "TabbedPane.tabWidthMode" );
|
||||||
closeIcon = UIManager.getIcon( "TabbedPane.closeIcon" );
|
closeIcon = UIManager.getIcon( "TabbedPane.closeIcon" );
|
||||||
|
|
||||||
|
buttonInsets = UIManager.getInsets( "TabbedPane.buttonInsets" );
|
||||||
|
buttonArc = UIManager.getInt( "TabbedPane.buttonArc" );
|
||||||
|
|
||||||
Locale l = tabPane.getLocale();
|
Locale l = tabPane.getLocale();
|
||||||
moreTabsButtonToolTipText = UIManager.getString( "TabbedPane.moreTabsButtonToolTipText", l );
|
moreTabsButtonToolTipText = UIManager.getString( "TabbedPane.moreTabsButtonToolTipText", l );
|
||||||
|
|
||||||
@@ -279,6 +306,7 @@ public class FlatTabbedPaneUI
|
|||||||
|
|
||||||
super.uninstallDefaults();
|
super.uninstallDefaults();
|
||||||
|
|
||||||
|
foreground = null;
|
||||||
disabledForeground = null;
|
disabledForeground = null;
|
||||||
selectedBackground = null;
|
selectedBackground = null;
|
||||||
selectedForeground = null;
|
selectedForeground = null;
|
||||||
@@ -288,9 +316,11 @@ public class FlatTabbedPaneUI
|
|||||||
focusColor = null;
|
focusColor = null;
|
||||||
tabSeparatorColor = null;
|
tabSeparatorColor = null;
|
||||||
contentAreaColor = null;
|
contentAreaColor = null;
|
||||||
|
|
||||||
closeIcon = null;
|
closeIcon = null;
|
||||||
|
|
||||||
|
buttonHoverBackground = null;
|
||||||
|
buttonPressedBackground = null;
|
||||||
|
|
||||||
MigLayoutVisualPadding.uninstall( tabPane );
|
MigLayoutVisualPadding.uninstall( tabPane );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -825,13 +855,14 @@ public class FlatTabbedPaneUI
|
|||||||
{
|
{
|
||||||
// paint tab background
|
// paint tab background
|
||||||
boolean enabled = tabPane.isEnabled();
|
boolean enabled = tabPane.isEnabled();
|
||||||
g.setColor( enabled && tabPane.isEnabledAt( tabIndex ) && getRolloverTab() == tabIndex
|
Color background = enabled && tabPane.isEnabledAt( tabIndex ) && getRolloverTab() == tabIndex
|
||||||
? hoverColor
|
? hoverColor
|
||||||
: (enabled && isSelected && FlatUIUtils.isPermanentFocusOwner( tabPane )
|
: (enabled && isSelected && FlatUIUtils.isPermanentFocusOwner( tabPane )
|
||||||
? focusColor
|
? focusColor
|
||||||
: (selectedBackground != null && enabled && isSelected
|
: (selectedBackground != null && enabled && isSelected
|
||||||
? selectedBackground
|
? selectedBackground
|
||||||
: tabPane.getBackgroundAt( tabIndex ))) );
|
: tabPane.getBackgroundAt( tabIndex )));
|
||||||
|
g.setColor( FlatUIUtils.deriveColor( background, tabPane.getBackground() ) );
|
||||||
g.fillRect( x, y, w, h );
|
g.fillRect( x, y, w, h );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -852,6 +883,10 @@ public class FlatTabbedPaneUI
|
|||||||
bm.setRollover( rollover && isRolloverTabClose() );
|
bm.setRollover( rollover && isRolloverTabClose() );
|
||||||
bm.setPressed( rollover && isPressedTabClose() );
|
bm.setPressed( rollover && isPressedTabClose() );
|
||||||
|
|
||||||
|
// copy colors from tabbed pane because close icon uses derives colors
|
||||||
|
tabCloseButton.setBackground( tabPane.getBackground() );
|
||||||
|
tabCloseButton.setForeground( tabPane.getForeground() );
|
||||||
|
|
||||||
// paint tab close icon
|
// paint tab close icon
|
||||||
Rectangle tabCloseRect = getTabCloseBounds( tabIndex, x, y, w, h, calcRect );
|
Rectangle tabCloseRect = getTabCloseBounds( tabIndex, x, y, w, h, calcRect );
|
||||||
closeIcon.paintIcon( tabCloseButton, g, tabCloseRect.x, tabCloseRect.y );
|
closeIcon.paintIcon( tabCloseButton, g, tabCloseRect.x, tabCloseRect.y );
|
||||||
@@ -1370,20 +1405,62 @@ public class FlatTabbedPaneUI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---- class FlatTabAreaButton --------------------------------------------
|
||||||
|
|
||||||
|
protected class FlatTabAreaButton
|
||||||
|
extends FlatArrowButton
|
||||||
|
{
|
||||||
|
public FlatTabAreaButton( int direction ) {
|
||||||
|
super( direction, arrowType,
|
||||||
|
FlatTabbedPaneUI.this.foreground, FlatTabbedPaneUI.this.disabledForeground,
|
||||||
|
null, buttonHoverBackground, null, buttonPressedBackground );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Color deriveBackground( Color background ) {
|
||||||
|
return FlatUIUtils.deriveColor( background, tabPane.getBackground() );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paint( Graphics g ) {
|
||||||
|
// fill button background
|
||||||
|
if( tabsOpaque || tabPane.isOpaque() ) {
|
||||||
|
g.setColor( tabPane.getBackground() );
|
||||||
|
g.fillRect( 0, 0, getWidth(), getHeight() );
|
||||||
|
}
|
||||||
|
|
||||||
|
super.paint( g );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void paintBackground( Graphics2D g ) {
|
||||||
|
// rotate button insets
|
||||||
|
Insets insets = new Insets( 0, 0, 0, 0 );
|
||||||
|
rotateInsets( buttonInsets, insets, tabPane.getTabPlacement() );
|
||||||
|
|
||||||
|
// use UIScale.scale2() here because this gives smaller insets at 150% and 175%
|
||||||
|
int top = UIScale.scale2( insets.top );
|
||||||
|
int left = UIScale.scale2( insets.left );
|
||||||
|
int bottom = UIScale.scale2( insets.bottom );
|
||||||
|
int right = UIScale.scale2( insets.right );
|
||||||
|
|
||||||
|
FlatUIUtils.paintComponentBackground( g, left, top,
|
||||||
|
getWidth() - left - right,
|
||||||
|
getHeight() - top - bottom,
|
||||||
|
0, scale( buttonArc ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---- class FlatMoreTabsButton -------------------------------------------
|
//---- class FlatMoreTabsButton -------------------------------------------
|
||||||
|
|
||||||
protected class FlatMoreTabsButton
|
protected class FlatMoreTabsButton
|
||||||
extends FlatArrowButton
|
extends FlatTabAreaButton
|
||||||
implements ActionListener, PopupMenuListener
|
implements ActionListener, PopupMenuListener
|
||||||
{
|
{
|
||||||
private boolean popupVisible;
|
private boolean popupVisible;
|
||||||
|
|
||||||
public FlatMoreTabsButton() {
|
public FlatMoreTabsButton() {
|
||||||
// this method is invoked before installDefaults(), so we can not use color fields here
|
super( SOUTH );
|
||||||
super( SOUTH, UIManager.getString( "TabbedPane.arrowType" ),
|
|
||||||
UIManager.getColor( "TabbedPane.foreground" ),
|
|
||||||
UIManager.getColor( "TabbedPane.disabledForeground" ), null,
|
|
||||||
UIManager.getColor( "TabbedPane.hoverColor" ) );
|
|
||||||
|
|
||||||
updateDirection();
|
updateDirection();
|
||||||
setToolTipText( moreTabsButtonToolTipText );
|
setToolTipText( moreTabsButtonToolTipText );
|
||||||
@@ -1417,7 +1494,7 @@ public class FlatTabbedPaneUI
|
|||||||
public void paint( Graphics g ) {
|
public void paint( Graphics g ) {
|
||||||
// paint arrow button near separator line
|
// paint arrow button near separator line
|
||||||
if( direction == EAST || direction == WEST ) {
|
if( direction == EAST || direction == WEST ) {
|
||||||
int xoffset = (getWidth() / 2) - getHeight();
|
int xoffset = Math.max( UIScale.unscale( (getWidth() - getHeight()) / 2 ) - 4, 0 );
|
||||||
setXOffset( (direction == EAST) ? xoffset : -xoffset );
|
setXOffset( (direction == EAST) ? xoffset : -xoffset );
|
||||||
} else
|
} else
|
||||||
setXOffset( 0 );
|
setXOffset( 0 );
|
||||||
@@ -1520,17 +1597,13 @@ public class FlatTabbedPaneUI
|
|||||||
//---- class FlatScrollableTabButton --------------------------------------
|
//---- class FlatScrollableTabButton --------------------------------------
|
||||||
|
|
||||||
protected class FlatScrollableTabButton
|
protected class FlatScrollableTabButton
|
||||||
extends FlatArrowButton
|
extends FlatTabAreaButton
|
||||||
implements MouseListener
|
implements MouseListener
|
||||||
{
|
{
|
||||||
private Timer autoRepeatTimer;
|
private Timer autoRepeatTimer;
|
||||||
|
|
||||||
protected FlatScrollableTabButton( int direction ) {
|
protected FlatScrollableTabButton( int direction ) {
|
||||||
// this method is invoked before installDefaults(), so we can not use color fields here
|
super( direction );
|
||||||
super( direction, UIManager.getString( "TabbedPane.arrowType" ),
|
|
||||||
UIManager.getColor( "TabbedPane.foreground" ),
|
|
||||||
UIManager.getColor( "TabbedPane.disabledForeground" ), null,
|
|
||||||
UIManager.getColor( "TabbedPane.hoverColor" ) );
|
|
||||||
|
|
||||||
addMouseListener( this );
|
addMouseListener( this );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,15 +254,18 @@ SplitPaneDivider.oneTouchHoverArrowColor=#7A7D81
|
|||||||
|
|
||||||
TabbedPane.underlineColor=#4A88C7
|
TabbedPane.underlineColor=#4A88C7
|
||||||
TabbedPane.disabledUnderlineColor=#7a7a7a
|
TabbedPane.disabledUnderlineColor=#7a7a7a
|
||||||
TabbedPane.hoverColor=#2e3133
|
TabbedPane.hoverColor=darken($TabbedPane.background,5%,derived noAutoInverse)
|
||||||
TabbedPane.focusColor=#3d4b5c
|
TabbedPane.focusColor=#3d4b5c
|
||||||
TabbedPane.contentAreaColor=#646464
|
TabbedPane.contentAreaColor=#646464
|
||||||
|
|
||||||
|
TabbedPane.buttonHoverBackground=darken($TabbedPane.background,5%,derived noAutoInverse)
|
||||||
|
TabbedPane.buttonPressedBackground=darken($TabbedPane.background,8%,derived noAutoInverse)
|
||||||
|
|
||||||
TabbedPane.closeBackground=null
|
TabbedPane.closeBackground=null
|
||||||
TabbedPane.closeForeground=@disabledText
|
TabbedPane.closeForeground=@disabledText
|
||||||
TabbedPane.closeHoverBackground=lighten($TabbedPane.hoverColor,10%)
|
TabbedPane.closeHoverBackground=lighten($TabbedPane.background,5%,derived)
|
||||||
TabbedPane.closeHoverForeground=@foreground
|
TabbedPane.closeHoverForeground=@foreground
|
||||||
TabbedPane.closePressedBackground=lighten($TabbedPane.hoverColor,15%)
|
TabbedPane.closePressedBackground=lighten($TabbedPane.background,10%,derived)
|
||||||
TabbedPane.closePressedForeground=$TabbedPane.closeHoverForeground
|
TabbedPane.closePressedForeground=$TabbedPane.closeHoverForeground
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -567,8 +567,11 @@ TabbedPane.tabAreaAlignment=leading
|
|||||||
TabbedPane.tabAlignment=center
|
TabbedPane.tabAlignment=center
|
||||||
# allowed values: preferred, equal or compact
|
# allowed values: preferred, equal or compact
|
||||||
TabbedPane.tabWidthMode=preferred
|
TabbedPane.tabWidthMode=preferred
|
||||||
|
|
||||||
# allowed values: chevron or triangle
|
# allowed values: chevron or triangle
|
||||||
TabbedPane.arrowType=chevron
|
TabbedPane.arrowType=chevron
|
||||||
|
TabbedPane.buttonInsets=2,1,2,1
|
||||||
|
TabbedPane.buttonArc=$Button.arc
|
||||||
|
|
||||||
TabbedPane.closeIcon=com.formdev.flatlaf.icons.FlatTabbedPaneCloseIcon
|
TabbedPane.closeIcon=com.formdev.flatlaf.icons.FlatTabbedPaneCloseIcon
|
||||||
TabbedPane.closeSize=16,16
|
TabbedPane.closeSize=16,16
|
||||||
|
|||||||
@@ -266,15 +266,18 @@ SplitPaneDivider.oneTouchHoverArrowColor=#333
|
|||||||
|
|
||||||
TabbedPane.underlineColor=#4083C9
|
TabbedPane.underlineColor=#4083C9
|
||||||
TabbedPane.disabledUnderlineColor=#ababab
|
TabbedPane.disabledUnderlineColor=#ababab
|
||||||
TabbedPane.hoverColor=#d9d9d9
|
TabbedPane.hoverColor=darken($TabbedPane.background,7%,derived)
|
||||||
TabbedPane.focusColor=#dae4ed
|
TabbedPane.focusColor=#dae4ed
|
||||||
TabbedPane.contentAreaColor=#bfbfbf
|
TabbedPane.contentAreaColor=#bfbfbf
|
||||||
|
|
||||||
|
TabbedPane.buttonHoverBackground=darken($TabbedPane.background,7%,derived)
|
||||||
|
TabbedPane.buttonPressedBackground=darken($TabbedPane.background,10%,derived)
|
||||||
|
|
||||||
TabbedPane.closeBackground=null
|
TabbedPane.closeBackground=null
|
||||||
TabbedPane.closeForeground=@disabledText
|
TabbedPane.closeForeground=@disabledText
|
||||||
TabbedPane.closeHoverBackground=darken($TabbedPane.hoverColor,10%)
|
TabbedPane.closeHoverBackground=darken($TabbedPane.background,20%,derived)
|
||||||
TabbedPane.closeHoverForeground=@foreground
|
TabbedPane.closeHoverForeground=@foreground
|
||||||
TabbedPane.closePressedBackground=darken($TabbedPane.hoverColor,15%)
|
TabbedPane.closePressedBackground=darken($TabbedPane.background,25%,derived)
|
||||||
TabbedPane.closePressedForeground=$TabbedPane.closeHoverForeground
|
TabbedPane.closePressedForeground=$TabbedPane.closeHoverForeground
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -911,15 +911,19 @@ SplitPaneUI com.formdev.flatlaf.ui.FlatSplitPaneUI
|
|||||||
|
|
||||||
TabbedPane.arrowType chevron
|
TabbedPane.arrowType chevron
|
||||||
TabbedPane.background #3c3f41 javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.background #3c3f41 javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
TabbedPane.buttonArc 6
|
||||||
|
TabbedPane.buttonHoverBackground #303234 com.formdev.flatlaf.util.DerivedColor [UI] darken(5%)
|
||||||
|
TabbedPane.buttonInsets 2,1,2,1 javax.swing.plaf.InsetsUIResource [UI]
|
||||||
|
TabbedPane.buttonPressedBackground #282a2c com.formdev.flatlaf.util.DerivedColor [UI] darken(8%)
|
||||||
TabbedPane.closeArc 4
|
TabbedPane.closeArc 4
|
||||||
TabbedPane.closeCrossFilledSize 7.5
|
TabbedPane.closeCrossFilledSize 7.5
|
||||||
TabbedPane.closeCrossLineWidth 1.0
|
TabbedPane.closeCrossLineWidth 1.0
|
||||||
TabbedPane.closeCrossPlainSize 7.5
|
TabbedPane.closeCrossPlainSize 7.5
|
||||||
TabbedPane.closeForeground #888888 javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.closeForeground #888888 javax.swing.plaf.ColorUIResource [UI]
|
||||||
TabbedPane.closeHoverBackground #464b4e javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.closeHoverBackground #484c4e com.formdev.flatlaf.util.DerivedColor [UI] lighten(5% autoInverse)
|
||||||
TabbedPane.closeHoverForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.closeHoverForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
|
||||||
TabbedPane.closeIcon [lazy] 16,16 com.formdev.flatlaf.icons.FlatTabbedPaneCloseIcon [UI]
|
TabbedPane.closeIcon [lazy] 16,16 com.formdev.flatlaf.icons.FlatTabbedPaneCloseIcon [UI]
|
||||||
TabbedPane.closePressedBackground #52585b javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.closePressedBackground #54595c com.formdev.flatlaf.util.DerivedColor [UI] lighten(10% autoInverse)
|
||||||
TabbedPane.closePressedForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.closePressedForeground #bbbbbb 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 #646464 javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.contentAreaColor #646464 javax.swing.plaf.ColorUIResource [UI]
|
||||||
@@ -935,7 +939,7 @@ TabbedPane.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
|
|||||||
TabbedPane.hasFullBorder false
|
TabbedPane.hasFullBorder false
|
||||||
TabbedPane.hiddenTabsNavigation moreTabsButton
|
TabbedPane.hiddenTabsNavigation moreTabsButton
|
||||||
TabbedPane.highlight #242424 javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.highlight #242424 javax.swing.plaf.ColorUIResource [UI]
|
||||||
TabbedPane.hoverColor #2e3133 javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.hoverColor #303234 com.formdev.flatlaf.util.DerivedColor [UI] darken(5%)
|
||||||
TabbedPane.labelShift 1
|
TabbedPane.labelShift 1
|
||||||
TabbedPane.light #313131 javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.light #313131 javax.swing.plaf.ColorUIResource [UI]
|
||||||
TabbedPane.selectedLabelShift -1
|
TabbedPane.selectedLabelShift -1
|
||||||
@@ -1150,7 +1154,7 @@ ToggleButton.selectedForeground #bbbbbb javax.swing.plaf.ColorUIResource [UI]
|
|||||||
ToggleButton.shadow #646464 javax.swing.plaf.ColorUIResource [UI]
|
ToggleButton.shadow #646464 javax.swing.plaf.ColorUIResource [UI]
|
||||||
ToggleButton.tab.disabledUnderlineColor #7a7a7a javax.swing.plaf.ColorUIResource [UI]
|
ToggleButton.tab.disabledUnderlineColor #7a7a7a javax.swing.plaf.ColorUIResource [UI]
|
||||||
ToggleButton.tab.focusBackground #3d4b5c javax.swing.plaf.ColorUIResource [UI]
|
ToggleButton.tab.focusBackground #3d4b5c javax.swing.plaf.ColorUIResource [UI]
|
||||||
ToggleButton.tab.hoverBackground #2e3133 javax.swing.plaf.ColorUIResource [UI]
|
ToggleButton.tab.hoverBackground #303234 com.formdev.flatlaf.util.DerivedColor [UI] darken(5%)
|
||||||
ToggleButton.tab.underlineColor #4a88c7 javax.swing.plaf.ColorUIResource [UI]
|
ToggleButton.tab.underlineColor #4a88c7 javax.swing.plaf.ColorUIResource [UI]
|
||||||
ToggleButton.tab.underlineHeight 2
|
ToggleButton.tab.underlineHeight 2
|
||||||
ToggleButton.textIconGap 4
|
ToggleButton.textIconGap 4
|
||||||
|
|||||||
@@ -916,15 +916,19 @@ SplitPaneUI com.formdev.flatlaf.ui.FlatSplitPaneUI
|
|||||||
|
|
||||||
TabbedPane.arrowType chevron
|
TabbedPane.arrowType chevron
|
||||||
TabbedPane.background #f2f2f2 javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.background #f2f2f2 javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
TabbedPane.buttonArc 6
|
||||||
|
TabbedPane.buttonHoverBackground #e0e0e0 com.formdev.flatlaf.util.DerivedColor [UI] darken(7% autoInverse)
|
||||||
|
TabbedPane.buttonInsets 2,1,2,1 javax.swing.plaf.InsetsUIResource [UI]
|
||||||
|
TabbedPane.buttonPressedBackground #d9d9d9 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse)
|
||||||
TabbedPane.closeArc 4
|
TabbedPane.closeArc 4
|
||||||
TabbedPane.closeCrossFilledSize 7.5
|
TabbedPane.closeCrossFilledSize 7.5
|
||||||
TabbedPane.closeCrossLineWidth 1.0
|
TabbedPane.closeCrossLineWidth 1.0
|
||||||
TabbedPane.closeCrossPlainSize 7.5
|
TabbedPane.closeCrossPlainSize 7.5
|
||||||
TabbedPane.closeForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.closeForeground #8c8c8c javax.swing.plaf.ColorUIResource [UI]
|
||||||
TabbedPane.closeHoverBackground #c0c0c0 javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.closeHoverBackground #bfbfbf com.formdev.flatlaf.util.DerivedColor [UI] darken(20% autoInverse)
|
||||||
TabbedPane.closeHoverForeground #000000 javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.closeHoverForeground #000000 javax.swing.plaf.ColorUIResource [UI]
|
||||||
TabbedPane.closeIcon [lazy] 16,16 com.formdev.flatlaf.icons.FlatTabbedPaneCloseIcon [UI]
|
TabbedPane.closeIcon [lazy] 16,16 com.formdev.flatlaf.icons.FlatTabbedPaneCloseIcon [UI]
|
||||||
TabbedPane.closePressedBackground #b3b3b3 javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.closePressedBackground #b2b2b2 com.formdev.flatlaf.util.DerivedColor [UI] darken(25% autoInverse)
|
||||||
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 #bfbfbf javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.contentAreaColor #bfbfbf javax.swing.plaf.ColorUIResource [UI]
|
||||||
@@ -940,7 +944,7 @@ TabbedPane.foreground #000000 javax.swing.plaf.ColorUIResource [UI]
|
|||||||
TabbedPane.hasFullBorder false
|
TabbedPane.hasFullBorder false
|
||||||
TabbedPane.hiddenTabsNavigation moreTabsButton
|
TabbedPane.hiddenTabsNavigation moreTabsButton
|
||||||
TabbedPane.highlight #ffffff javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.highlight #ffffff javax.swing.plaf.ColorUIResource [UI]
|
||||||
TabbedPane.hoverColor #d9d9d9 javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.hoverColor #e0e0e0 com.formdev.flatlaf.util.DerivedColor [UI] darken(7% autoInverse)
|
||||||
TabbedPane.labelShift 1
|
TabbedPane.labelShift 1
|
||||||
TabbedPane.light #e3e3e3 javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.light #e3e3e3 javax.swing.plaf.ColorUIResource [UI]
|
||||||
TabbedPane.selectedLabelShift -1
|
TabbedPane.selectedLabelShift -1
|
||||||
@@ -1155,7 +1159,7 @@ ToggleButton.selectedForeground #000000 javax.swing.plaf.ColorUIResource [UI]
|
|||||||
ToggleButton.shadow #c4c4c4 javax.swing.plaf.ColorUIResource [UI]
|
ToggleButton.shadow #c4c4c4 javax.swing.plaf.ColorUIResource [UI]
|
||||||
ToggleButton.tab.disabledUnderlineColor #ababab javax.swing.plaf.ColorUIResource [UI]
|
ToggleButton.tab.disabledUnderlineColor #ababab javax.swing.plaf.ColorUIResource [UI]
|
||||||
ToggleButton.tab.focusBackground #dae4ed javax.swing.plaf.ColorUIResource [UI]
|
ToggleButton.tab.focusBackground #dae4ed javax.swing.plaf.ColorUIResource [UI]
|
||||||
ToggleButton.tab.hoverBackground #d9d9d9 javax.swing.plaf.ColorUIResource [UI]
|
ToggleButton.tab.hoverBackground #e0e0e0 com.formdev.flatlaf.util.DerivedColor [UI] darken(7% autoInverse)
|
||||||
ToggleButton.tab.underlineColor #4083c9 javax.swing.plaf.ColorUIResource [UI]
|
ToggleButton.tab.underlineColor #4083c9 javax.swing.plaf.ColorUIResource [UI]
|
||||||
ToggleButton.tab.underlineHeight 2
|
ToggleButton.tab.underlineHeight 2
|
||||||
ToggleButton.textIconGap 4
|
ToggleButton.textIconGap 4
|
||||||
|
|||||||
@@ -904,6 +904,10 @@ SplitPaneUI com.formdev.flatlaf.ui.FlatSplitPaneUI
|
|||||||
|
|
||||||
TabbedPane.arrowType chevron
|
TabbedPane.arrowType chevron
|
||||||
TabbedPane.background #ccffcc javax.swing.plaf.ColorUIResource [UI]
|
TabbedPane.background #ccffcc javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
TabbedPane.buttonArc 6
|
||||||
|
TabbedPane.buttonHoverBackground #ffff00 javax.swing.plaf.ColorUIResource [UI]
|
||||||
|
TabbedPane.buttonInsets 2,1,2,1 javax.swing.plaf.InsetsUIResource [UI]
|
||||||
|
TabbedPane.buttonPressedBackground #ffc800 javax.swing.plaf.ColorUIResource [UI]
|
||||||
TabbedPane.closeArc 999
|
TabbedPane.closeArc 999
|
||||||
TabbedPane.closeCrossFilledSize 6.5
|
TabbedPane.closeCrossFilledSize 6.5
|
||||||
TabbedPane.closeCrossLineWidth 2.0
|
TabbedPane.closeCrossLineWidth 2.0
|
||||||
|
|||||||
@@ -284,6 +284,9 @@ TabbedPane.focusColor=#ddd
|
|||||||
TabbedPane.tabSeparatorColor=#00f
|
TabbedPane.tabSeparatorColor=#00f
|
||||||
TabbedPane.contentAreaColor=#f00
|
TabbedPane.contentAreaColor=#f00
|
||||||
|
|
||||||
|
TabbedPane.buttonHoverBackground=#ff0
|
||||||
|
TabbedPane.buttonPressedBackground=#FFC800
|
||||||
|
|
||||||
TabbedPane.closeSize=16,16
|
TabbedPane.closeSize=16,16
|
||||||
TabbedPane.closeArc=999
|
TabbedPane.closeArc=999
|
||||||
TabbedPane.closeCrossPlainSize={float}12
|
TabbedPane.closeCrossPlainSize={float}12
|
||||||
|
|||||||
@@ -640,6 +640,10 @@ SplitPaneUI
|
|||||||
TabbedPane.ancestorInputMap
|
TabbedPane.ancestorInputMap
|
||||||
TabbedPane.arrowType
|
TabbedPane.arrowType
|
||||||
TabbedPane.background
|
TabbedPane.background
|
||||||
|
TabbedPane.buttonArc
|
||||||
|
TabbedPane.buttonHoverBackground
|
||||||
|
TabbedPane.buttonInsets
|
||||||
|
TabbedPane.buttonPressedBackground
|
||||||
TabbedPane.closeArc
|
TabbedPane.closeArc
|
||||||
TabbedPane.closeCrossFilledSize
|
TabbedPane.closeCrossFilledSize
|
||||||
TabbedPane.closeCrossLineWidth
|
TabbedPane.closeCrossLineWidth
|
||||||
|
|||||||
Reference in New Issue
Block a user