mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 14:37:13 -06:00
TabbedPane: support background color for selected tabs
This commit is contained in:
@@ -1,6 +1,11 @@
|
|||||||
FlatLaf Change Log
|
FlatLaf Change Log
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
- TabbedPane: Support background color for selected tabs.
|
||||||
|
|
||||||
|
|
||||||
## 0.21
|
## 0.21
|
||||||
|
|
||||||
- ScrollBar: Show decrease/increase arrow buttons if client property
|
- ScrollBar: Show decrease/increase arrow buttons if client property
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ import com.formdev.flatlaf.FlatLaf;
|
|||||||
* @uiDefault TabbedPane.foreground Color
|
* @uiDefault TabbedPane.foreground Color
|
||||||
* @uiDefault TabbedPane.shadow Color used for scroll arrows and cropped line
|
* @uiDefault TabbedPane.shadow Color used for scroll arrows and cropped line
|
||||||
* @uiDefault TabbedPane.disabledForeground Color
|
* @uiDefault TabbedPane.disabledForeground Color
|
||||||
|
* @uiDefault TabbedPane.selectedBackground Color optional
|
||||||
* @uiDefault TabbedPane.selectedForeground Color
|
* @uiDefault TabbedPane.selectedForeground Color
|
||||||
* @uiDefault TabbedPane.underlineColor Color
|
* @uiDefault TabbedPane.underlineColor Color
|
||||||
* @uiDefault TabbedPane.disabledUnderlineColor Color
|
* @uiDefault TabbedPane.disabledUnderlineColor Color
|
||||||
@@ -73,6 +74,7 @@ public class FlatTabbedPaneUI
|
|||||||
extends BasicTabbedPaneUI
|
extends BasicTabbedPaneUI
|
||||||
{
|
{
|
||||||
protected Color disabledForeground;
|
protected Color disabledForeground;
|
||||||
|
protected Color selectedBackground;
|
||||||
protected Color selectedForeground;
|
protected Color selectedForeground;
|
||||||
protected Color underlineColor;
|
protected Color underlineColor;
|
||||||
protected Color disabledUnderlineColor;
|
protected Color disabledUnderlineColor;
|
||||||
@@ -95,6 +97,7 @@ public class FlatTabbedPaneUI
|
|||||||
super.installDefaults();
|
super.installDefaults();
|
||||||
|
|
||||||
disabledForeground = UIManager.getColor( "TabbedPane.disabledForeground" );
|
disabledForeground = UIManager.getColor( "TabbedPane.disabledForeground" );
|
||||||
|
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" );
|
||||||
disabledUnderlineColor = UIManager.getColor( "TabbedPane.disabledUnderlineColor" );
|
disabledUnderlineColor = UIManager.getColor( "TabbedPane.disabledUnderlineColor" );
|
||||||
@@ -124,6 +127,7 @@ public class FlatTabbedPaneUI
|
|||||||
super.uninstallDefaults();
|
super.uninstallDefaults();
|
||||||
|
|
||||||
disabledForeground = null;
|
disabledForeground = null;
|
||||||
|
selectedBackground = null;
|
||||||
selectedForeground = null;
|
selectedForeground = null;
|
||||||
underlineColor = null;
|
underlineColor = null;
|
||||||
disabledUnderlineColor = null;
|
disabledUnderlineColor = null;
|
||||||
@@ -262,7 +266,9 @@ public class FlatTabbedPaneUI
|
|||||||
? hoverColor
|
? hoverColor
|
||||||
: (enabled && isSelected && tabPane.hasFocus()
|
: (enabled && isSelected && tabPane.hasFocus()
|
||||||
? focusColor
|
? focusColor
|
||||||
: tabPane.getBackgroundAt( tabIndex )) );
|
: (selectedBackground != null && enabled && isSelected
|
||||||
|
? selectedBackground
|
||||||
|
: tabPane.getBackgroundAt( tabIndex ))) );
|
||||||
g.fillRect( x, y, w, h );
|
g.fillRect( x, y, w, h );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,7 +340,7 @@ public class FlatTabbedPaneUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actually does the nearly the same as super.paintContentBorder() but
|
* Actually does nearly the same as super.paintContentBorder() but
|
||||||
* - not using UIManager.getColor("TabbedPane.contentAreaColor") to be GUI builder friendly
|
* - not using UIManager.getColor("TabbedPane.contentAreaColor") to be GUI builder friendly
|
||||||
* - not invoking paintContentBorder*Edge() methods
|
* - not invoking paintContentBorder*Edge() methods
|
||||||
* - repaint selection
|
* - repaint selection
|
||||||
|
|||||||
@@ -229,6 +229,8 @@ SplitPaneDivider.oneTouchHoverArrowColor=#ff0000
|
|||||||
#---- TabbedPane ----
|
#---- TabbedPane ----
|
||||||
|
|
||||||
TabbedPane.disabledForeground=#777777
|
TabbedPane.disabledForeground=#777777
|
||||||
|
TabbedPane.selectedBackground=#0f0
|
||||||
|
TabbedPane.selectedForeground=#00f
|
||||||
TabbedPane.underlineColor=#4A88C7
|
TabbedPane.underlineColor=#4A88C7
|
||||||
TabbedPane.disabledUnderlineColor=#7a7a7a
|
TabbedPane.disabledUnderlineColor=#7a7a7a
|
||||||
TabbedPane.hoverColor=#eeeeee
|
TabbedPane.hoverColor=#eeeeee
|
||||||
|
|||||||
Reference in New Issue
Block a user