From 5151951f46c62a00d9edabc7e8990a75b451d1b8 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Sat, 28 May 2022 12:16:02 +0200 Subject: [PATCH] Button and ToggleButton: added missing foreground colors for hover, pressed, focused and selected states (issue #535) --- CHANGELOG.md | 2 + .../com/formdev/flatlaf/ui/FlatButtonUI.java | 85 +++++++++++++++++-- .../flatlaf/ui/FlatToggleButtonUI.java | 16 +++- .../flatlaf/ui/TestFlatStyleableInfo.java | 12 +++ .../formdev/flatlaf/ui/TestFlatStyling.java | 12 +++ .../dumps/uidefaults/FlatTestLaf_1.8.0.txt | 23 +++++ .../flatlaf/testing/FlatTestLaf.properties | 25 ++++++ .../flatlaf/themeeditor/FlatLafUIKeys.txt | 21 +++++ 8 files changed, 188 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20986486..40410106 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ FlatLaf Change Log #### New features and improvements +- Button and ToggleButton: Added missing foreground colors for hover, pressed, + focused and selected states. (issue #535) - Table: Optionally paint alternating rows below table if table is smaller than scroll pane. Set UI value `Table.paintOutsideAlternateRows` to `true`. Requires that `Table.alternateRowColor` is set to a color. (issue #504) diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatButtonUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatButtonUI.java index 6b9c71de..a8abf33b 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatButtonUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatButtonUI.java @@ -78,20 +78,27 @@ import com.formdev.flatlaf.util.UIScale; * @uiDefault Button.startBackground Color optional; if set, a gradient paint is used and Button.background is ignored * @uiDefault Button.endBackground Color optional; if set, a gradient paint is used * @uiDefault Button.focusedBackground Color optional + * @uiDefault Button.focusedForeground Color optional * @uiDefault Button.hoverBackground Color optional + * @uiDefault Button.hoverForeground Color optional * @uiDefault Button.pressedBackground Color optional + * @uiDefault Button.pressedForeground Color optional * @uiDefault Button.selectedBackground Color * @uiDefault Button.selectedForeground Color * @uiDefault Button.disabledBackground Color optional * @uiDefault Button.disabledText Color * @uiDefault Button.disabledSelectedBackground Color + * @uiDefault Button.disabledSelectedForeground Color optional * @uiDefault Button.default.background Color * @uiDefault Button.default.startBackground Color optional; if set, a gradient paint is used and Button.default.background is ignored * @uiDefault Button.default.endBackground Color optional; if set, a gradient paint is used * @uiDefault Button.default.foreground Color * @uiDefault Button.default.focusedBackground Color optional + * @uiDefault Button.default.focusedForeground Color optional * @uiDefault Button.default.hoverBackground Color optional + * @uiDefault Button.default.hoverForeground Color optional * @uiDefault Button.default.pressedBackground Color optional + * @uiDefault Button.default.pressedForeground Color optional * @uiDefault Button.default.boldText boolean * @uiDefault Button.paintShadow boolean default is false * @uiDefault Button.shadowWidth int default is 2 @@ -99,8 +106,13 @@ import com.formdev.flatlaf.util.UIScale; * @uiDefault Button.default.shadowColor Color optional * @uiDefault Button.toolbar.spacingInsets Insets * @uiDefault Button.toolbar.hoverBackground Color + * @uiDefault Button.toolbar.hoverForeground Color optional * @uiDefault Button.toolbar.pressedBackground Color + * @uiDefault Button.toolbar.pressedForeground Color optional * @uiDefault Button.toolbar.selectedBackground Color + * @uiDefault Button.toolbar.selectedForeground Color optional + * @uiDefault Button.toolbar.disabledSelectedBackground Color optional + * @uiDefault Button.toolbar.disabledSelectedForeground Color optional * * @author Karl Tauber */ @@ -117,20 +129,27 @@ public class FlatButtonUI protected Color startBackground; protected Color endBackground; @Styleable protected Color focusedBackground; + /** @since 2.3 */ @Styleable protected Color focusedForeground; @Styleable protected Color hoverBackground; + /** @since 2.3 */ @Styleable protected Color hoverForeground; @Styleable protected Color pressedBackground; + /** @since 2.3 */ @Styleable protected Color pressedForeground; @Styleable protected Color selectedBackground; @Styleable protected Color selectedForeground; @Styleable protected Color disabledBackground; @Styleable protected Color disabledText; @Styleable protected Color disabledSelectedBackground; + /** @since 2.3 */ @Styleable protected Color disabledSelectedForeground; @Styleable(dot=true) protected Color defaultBackground; protected Color defaultEndBackground; @Styleable(dot=true) protected Color defaultForeground; @Styleable(dot=true) protected Color defaultFocusedBackground; + /** @since 2.3 */ @Styleable(dot=true) protected Color defaultFocusedForeground; @Styleable(dot=true) protected Color defaultHoverBackground; + /** @since 2.3 */ @Styleable(dot=true) protected Color defaultHoverForeground; @Styleable(dot=true) protected Color defaultPressedBackground; + /** @since 2.3 */ @Styleable(dot=true) protected Color defaultPressedForeground; @Styleable(dot=true) protected boolean defaultBoldText; @Styleable protected boolean paintShadow; @@ -139,8 +158,13 @@ public class FlatButtonUI @Styleable(dot=true) protected Color defaultShadowColor; @Styleable(dot=true) protected Color toolbarHoverBackground; + /** @since 2.3 */ @Styleable(dot=true) protected Color toolbarHoverForeground; @Styleable(dot=true) protected Color toolbarPressedBackground; + /** @since 2.3 */ @Styleable(dot=true) protected Color toolbarPressedForeground; @Styleable(dot=true) protected Color toolbarSelectedBackground; + /** @since 2.3 */ @Styleable(dot=true) protected Color toolbarSelectedForeground; + /** @since 2.3 */ @Styleable(dot=true) protected Color toolbarDisabledSelectedBackground; + /** @since 2.3 */ @Styleable(dot=true) protected Color toolbarDisabledSelectedForeground; // only used via styling (not in UI defaults, but has likewise client properties) /** @since 2 */ @Styleable protected String buttonType; @@ -190,20 +214,27 @@ public class FlatButtonUI startBackground = UIManager.getColor( prefix + "startBackground" ); endBackground = UIManager.getColor( prefix + "endBackground" ); focusedBackground = UIManager.getColor( prefix + "focusedBackground" ); + focusedForeground = UIManager.getColor( prefix + "focusedForeground" ); hoverBackground = UIManager.getColor( prefix + "hoverBackground" ); + hoverForeground = UIManager.getColor( prefix + "hoverForeground" ); pressedBackground = UIManager.getColor( prefix + "pressedBackground" ); + pressedForeground = UIManager.getColor( prefix + "pressedForeground" ); selectedBackground = UIManager.getColor( prefix + "selectedBackground" ); selectedForeground = UIManager.getColor( prefix + "selectedForeground" ); disabledBackground = UIManager.getColor( prefix + "disabledBackground" ); disabledText = UIManager.getColor( prefix + "disabledText" ); disabledSelectedBackground = UIManager.getColor( prefix + "disabledSelectedBackground" ); + disabledSelectedForeground = UIManager.getColor( prefix + "disabledSelectedForeground" ); defaultBackground = FlatUIUtils.getUIColor( "Button.default.startBackground", "Button.default.background" ); defaultEndBackground = UIManager.getColor( "Button.default.endBackground" ); defaultForeground = UIManager.getColor( "Button.default.foreground" ); defaultFocusedBackground = UIManager.getColor( "Button.default.focusedBackground" ); + defaultFocusedForeground = UIManager.getColor( "Button.default.focusedForeground" ); defaultHoverBackground = UIManager.getColor( "Button.default.hoverBackground" ); + defaultHoverForeground = UIManager.getColor( "Button.default.hoverForeground" ); defaultPressedBackground = UIManager.getColor( "Button.default.pressedBackground" ); + defaultPressedForeground = UIManager.getColor( "Button.default.pressedForeground" ); defaultBoldText = UIManager.getBoolean( "Button.default.boldText" ); paintShadow = UIManager.getBoolean( "Button.paintShadow" ); @@ -212,8 +243,13 @@ public class FlatButtonUI defaultShadowColor = UIManager.getColor( "Button.default.shadowColor" ); toolbarHoverBackground = UIManager.getColor( prefix + "toolbar.hoverBackground" ); + toolbarHoverForeground = UIManager.getColor( prefix + "toolbar.hoverForeground" ); toolbarPressedBackground = UIManager.getColor( prefix + "toolbar.pressedBackground" ); + toolbarPressedForeground = UIManager.getColor( prefix + "toolbar.pressedForeground" ); toolbarSelectedBackground = UIManager.getColor( prefix + "toolbar.selectedBackground" ); + toolbarSelectedForeground = UIManager.getColor( prefix + "toolbar.selectedForeground" ); + toolbarDisabledSelectedBackground = UIManager.getColor( prefix + "toolbar.disabledSelectedBackground" ); + toolbarDisabledSelectedForeground = UIManager.getColor( prefix + "toolbar.disabledSelectedForeground" ); helpButtonIcon = UIManager.getIcon( "HelpButton.icon" ); defaultMargin = UIManager.getInsets( prefix + "margin" ); @@ -532,6 +568,8 @@ public class FlatButtonUI } public static void paintText( Graphics g, AbstractButton b, Rectangle textRect, String text, Color foreground ) { + if(foreground == null) + foreground=Color.red; FontMetrics fm = b.getFontMetrics( b.getFont() ); int mnemonicIndex = FlatLaf.isShowMnemonics() ? b.getDisplayedMnemonicIndex() : -1; @@ -545,11 +583,14 @@ public class FlatButtonUI // selected state if( ((AbstractButton)c).isSelected() ) { - // in toolbar use same background colors for disabled and enabled because + // in toolbar, if toolbarDisabledSelectedBackground is null, + // use same background colors for disabled and enabled because // we assume that toolbar icon is shown disabled return buttonStateColor( c, toolBarButton ? toolbarSelectedBackground : selectedBackground, - toolBarButton ? toolbarSelectedBackground : disabledSelectedBackground, + toolBarButton + ? (toolbarDisabledSelectedBackground != null ? toolbarDisabledSelectedBackground : toolbarSelectedBackground) + : disabledSelectedBackground, null, null, toolBarButton ? toolbarPressedBackground : pressedBackground ); @@ -614,18 +655,48 @@ public class FlatButtonUI } protected Color getForeground( JComponent c ) { - if( !c.isEnabled() ) - return disabledText; + boolean toolBarButton = isToolBarButton( c ) || isBorderlessButton( c ); - if( ((AbstractButton)c).isSelected() && !(isToolBarButton( c ) || isBorderlessButton( c )) ) - return selectedForeground; + // selected state + if( ((AbstractButton)c).isSelected() ) { + return buttonStateColor( c, + toolBarButton + ? (toolbarSelectedForeground != null ? toolbarSelectedForeground : c.getForeground()) + : selectedForeground, + toolBarButton + ? (toolbarDisabledSelectedForeground != null ? toolbarDisabledSelectedForeground : disabledText) + : (disabledSelectedForeground != null ? disabledSelectedForeground : disabledText), + null, + null, + toolBarButton ? toolbarPressedForeground : pressedForeground ); + } + // toolbar button + if( toolBarButton ) { + return buttonStateColor( c, + c.getForeground(), + disabledText, + null, + toolbarHoverForeground, + toolbarPressedForeground ); + } + + boolean def = isDefaultButton( c ); + return buttonStateColor( c, + getForegroundBase( c, def ), + disabledText, + isCustomForeground( c.getForeground() ) ? null : (def ? defaultFocusedForeground : focusedForeground), + def ? defaultHoverForeground : hoverForeground, + def ? defaultPressedForeground : pressedForeground ); + } + + /** @since 2.3 */ + protected Color getForegroundBase( JComponent c, boolean def ) { // use component foreground if explicitly set Color fg = c.getForeground(); if( isCustomForeground( fg ) ) return fg; - boolean def = isDefaultButton( c ); return def ? defaultForeground : fg; } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatToggleButtonUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatToggleButtonUI.java index 3e106ae5..b3ef3a5a 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatToggleButtonUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatToggleButtonUI.java @@ -48,15 +48,29 @@ import com.formdev.flatlaf.util.UIScale; * @uiDefault ToggleButton.iconTextGap int * @uiDefault ToggleButton.startBackground Color optional; if set, a gradient paint is used and ToggleButton.background is ignored * @uiDefault ToggleButton.endBackground Color optional; if set, a gradient paint is used - * @uiDefault ToggleButton.pressedBackground Color + * @uiDefault ToggleButton.focusedBackground Color optional + * @uiDefault ToggleButton.focusedForeground Color optional + * @uiDefault ToggleButton.hoverBackground Color optional + * @uiDefault ToggleButton.hoverForeground Color optional + * @uiDefault ToggleButton.pressedBackground Color optional + * @uiDefault ToggleButton.pressedForeground Color optional * @uiDefault ToggleButton.selectedBackground Color * @uiDefault ToggleButton.selectedForeground Color * @uiDefault ToggleButton.disabledBackground Color optional * @uiDefault ToggleButton.disabledText Color * @uiDefault ToggleButton.disabledSelectedBackground Color + * @uiDefault ToggleButton.disabledSelectedForeground Color optional + * @uiDefault Button.paintShadow boolean default is false + * @uiDefault Button.shadowWidth int default is 2 + * @uiDefault Button.shadowColor Color optional * @uiDefault ToggleButton.toolbar.hoverBackground Color + * @uiDefault ToggleButton.toolbar.hoverForeground Color optional * @uiDefault ToggleButton.toolbar.pressedBackground Color + * @uiDefault ToggleButton.toolbar.pressedForeground Color optional * @uiDefault ToggleButton.toolbar.selectedBackground Color + * @uiDefault ToggleButton.toolbar.selectedForeground Color optional + * @uiDefault ToggleButton.toolbar.disabledSelectedBackground Color optional + * @uiDefault ToggleButton.toolbar.disabledSelectedForeground Color optional * * * diff --git a/flatlaf-core/src/test/java/com/formdev/flatlaf/ui/TestFlatStyleableInfo.java b/flatlaf-core/src/test/java/com/formdev/flatlaf/ui/TestFlatStyleableInfo.java index 3101f125..7566c31f 100644 --- a/flatlaf-core/src/test/java/com/formdev/flatlaf/ui/TestFlatStyleableInfo.java +++ b/flatlaf-core/src/test/java/com/formdev/flatlaf/ui/TestFlatStyleableInfo.java @@ -96,19 +96,26 @@ public class TestFlatStyleableInfo "minimumWidth", int.class, "focusedBackground", Color.class, + "focusedForeground", Color.class, "hoverBackground", Color.class, + "hoverForeground", Color.class, "pressedBackground", Color.class, + "pressedForeground", Color.class, "selectedBackground", Color.class, "selectedForeground", Color.class, "disabledBackground", Color.class, "disabledText", Color.class, "disabledSelectedBackground", Color.class, + "disabledSelectedForeground", Color.class, "default.background", Color.class, "default.foreground", Color.class, "default.focusedBackground", Color.class, + "default.focusedForeground", Color.class, "default.hoverBackground", Color.class, + "default.hoverForeground", Color.class, "default.pressedBackground", Color.class, + "default.pressedForeground", Color.class, "default.boldText", boolean.class, "paintShadow", boolean.class, @@ -118,8 +125,13 @@ public class TestFlatStyleableInfo "toolbar.spacingInsets", Insets.class, "toolbar.hoverBackground", Color.class, + "toolbar.hoverForeground", Color.class, "toolbar.pressedBackground", Color.class, + "toolbar.pressedForeground", Color.class, "toolbar.selectedBackground", Color.class, + "toolbar.selectedForeground", Color.class, + "toolbar.disabledSelectedBackground", Color.class, + "toolbar.disabledSelectedForeground", Color.class, "buttonType", String.class, "squareSize", boolean.class, diff --git a/flatlaf-core/src/test/java/com/formdev/flatlaf/ui/TestFlatStyling.java b/flatlaf-core/src/test/java/com/formdev/flatlaf/ui/TestFlatStyling.java index 4f60e4c5..398331c5 100644 --- a/flatlaf-core/src/test/java/com/formdev/flatlaf/ui/TestFlatStyling.java +++ b/flatlaf-core/src/test/java/com/formdev/flatlaf/ui/TestFlatStyling.java @@ -221,19 +221,26 @@ public class TestFlatStyling ui.applyStyle( b, "minimumWidth: 100" ); ui.applyStyle( b, "focusedBackground: #fff" ); + ui.applyStyle( b, "focusedForeground: #fff" ); ui.applyStyle( b, "hoverBackground: #fff" ); + ui.applyStyle( b, "hoverForeground: #fff" ); ui.applyStyle( b, "pressedBackground: #fff" ); + ui.applyStyle( b, "pressedForeground: #fff" ); ui.applyStyle( b, "selectedBackground: #fff" ); ui.applyStyle( b, "selectedForeground: #fff" ); ui.applyStyle( b, "disabledBackground: #fff" ); ui.applyStyle( b, "disabledText: #fff" ); ui.applyStyle( b, "disabledSelectedBackground: #fff" ); + ui.applyStyle( b, "disabledSelectedForeground: #fff" ); ui.applyStyle( b, "default.background: #fff" ); ui.applyStyle( b, "default.foreground: #fff" ); ui.applyStyle( b, "default.focusedBackground: #fff" ); + ui.applyStyle( b, "default.focusedForeground: #fff" ); ui.applyStyle( b, "default.hoverBackground: #fff" ); + ui.applyStyle( b, "default.hoverForeground: #fff" ); ui.applyStyle( b, "default.pressedBackground: #fff" ); + ui.applyStyle( b, "default.pressedForeground: #fff" ); ui.applyStyle( b, "default.boldText: true" ); ui.applyStyle( b, "paintShadow: true" ); @@ -243,8 +250,13 @@ public class TestFlatStyling ui.applyStyle( b, "toolbar.spacingInsets: 1,2,3,4" ); ui.applyStyle( b, "toolbar.hoverBackground: #fff" ); + ui.applyStyle( b, "toolbar.hoverForeground: #fff" ); ui.applyStyle( b, "toolbar.pressedBackground: #fff" ); + ui.applyStyle( b, "toolbar.pressedForeground: #fff" ); ui.applyStyle( b, "toolbar.selectedBackground: #fff" ); + ui.applyStyle( b, "toolbar.selectedForeground: #fff" ); + ui.applyStyle( b, "toolbar.disabledSelectedBackground: #fff" ); + ui.applyStyle( b, "toolbar.disabledSelectedForeground: #fff" ); ui.applyStyle( b, "buttonType: help" ); ui.applyStyle( b, "squareSize: true" ); diff --git a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0.txt b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0.txt index aa5760b6..2a3ecbad 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0.txt @@ -73,43 +73,57 @@ Button.default.endBorderColor #0000ff HSL 240 100 50 javax.swing.plaf.Colo Button.default.focusColor #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] Button.default.focusedBackground #00ffff HSL 180 100 50 javax.swing.plaf.ColorUIResource [UI] Button.default.focusedBorderColor #537699 HSL 210 30 46 javax.swing.plaf.ColorUIResource [UI] +Button.default.focusedForeground #0000ff HSL 240 100 50 javax.swing.plaf.ColorUIResource [UI] Button.default.foreground #880000 HSL 0 100 27 javax.swing.plaf.ColorUIResource [UI] Button.default.hoverBackground #ffff00 HSL 60 100 50 javax.swing.plaf.ColorUIResource [UI] Button.default.hoverBorderColor #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] +Button.default.hoverForeground #0000ff HSL 240 100 50 javax.swing.plaf.ColorUIResource [UI] Button.default.pressedBackground #ffc800 HSL 47 100 50 javax.swing.plaf.ColorUIResource [UI] +Button.default.pressedForeground #0080ff HSL 210 100 50 javax.swing.plaf.ColorUIResource [UI] Button.default.startBackground #dddddd HSL 0 0 87 javax.swing.plaf.ColorUIResource [UI] Button.default.startBorderColor #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] Button.defaultButtonFollowsFocus false Button.disabledBackground #e0e0e0 HSL 0 0 88 javax.swing.plaf.ColorUIResource [UI] Button.disabledBorderColor #000088 HSL 240 100 27 javax.swing.plaf.ColorUIResource [UI] Button.disabledForeground #000088 HSL 240 100 27 javax.swing.plaf.ColorUIResource [UI] +Button.disabledSelectedBackground #112233 HSL 210 50 13 javax.swing.plaf.ColorUIResource [UI] +Button.disabledSelectedForeground #ffcccc HSL 0 100 90 javax.swing.plaf.ColorUIResource [UI] Button.disabledText #000088 HSL 240 100 27 javax.swing.plaf.ColorUIResource [UI] Button.endBackground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] Button.endBorderColor #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] Button.focusedBackground #00ffff HSL 180 100 50 javax.swing.plaf.ColorUIResource [UI] Button.focusedBorderColor #466d94 HSL 210 36 43 javax.swing.plaf.ColorUIResource [UI] +Button.focusedForeground #0000ff HSL 240 100 50 javax.swing.plaf.ColorUIResource [UI] Button.font [active] $defaultFont [UI] Button.foreground #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] Button.highlight #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] Button.hoverBackground #ffff00 HSL 60 100 50 javax.swing.plaf.ColorUIResource [UI] Button.hoverBorderColor #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] +Button.hoverForeground #0000ff HSL 240 100 50 javax.swing.plaf.ColorUIResource [UI] Button.iconTextGap 4 Button.innerFocusWidth 1 Button.light #e3e3e3 HSL 0 0 89 javax.swing.plaf.ColorUIResource [UI] Button.margin 2,14,2,14 javax.swing.plaf.InsetsUIResource [UI] Button.minimumWidth 72 Button.pressedBackground #ffc800 HSL 47 100 50 javax.swing.plaf.ColorUIResource [UI] +Button.pressedForeground #0080ff HSL 210 100 50 javax.swing.plaf.ColorUIResource [UI] Button.rollover true Button.selectedBackground #ffbbbb HSL 0 100 87 javax.swing.plaf.ColorUIResource [UI] +Button.selectedForeground #332211 HSL 30 50 13 javax.swing.plaf.ColorUIResource [UI] Button.shadow #a0a0a0 HSL 0 0 63 javax.swing.plaf.ColorUIResource [UI] Button.startBackground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] Button.startBorderColor #0000ff HSL 240 100 50 javax.swing.plaf.ColorUIResource [UI] Button.textIconGap 4 Button.textShiftOffset 0 +Button.toolbar.disabledSelectedBackground #cccccc HSL 0 0 80 javax.swing.plaf.ColorUIResource [UI] +Button.toolbar.disabledSelectedForeground #886666 HSL 0 14 47 javax.swing.plaf.ColorUIResource [UI] Button.toolbar.hoverBackground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] +Button.toolbar.hoverForeground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] Button.toolbar.margin 3,3,3,3 javax.swing.plaf.InsetsUIResource [UI] Button.toolbar.pressedBackground #eeeeee HSL 0 0 93 javax.swing.plaf.ColorUIResource [UI] +Button.toolbar.pressedForeground #666666 HSL 0 0 40 javax.swing.plaf.ColorUIResource [UI] Button.toolbar.selectedBackground #dddddd HSL 0 0 87 javax.swing.plaf.ColorUIResource [UI] +Button.toolbar.selectedForeground #880000 HSL 0 100 27 javax.swing.plaf.ColorUIResource [UI] Button.toolbar.spacingInsets 1,2,1,2 javax.swing.plaf.InsetsUIResource [UI] ButtonUI com.formdev.flatlaf.ui.FlatButtonUI @@ -1280,16 +1294,20 @@ ToggleButton.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.F ToggleButton.darkShadow #696969 HSL 0 0 41 javax.swing.plaf.ColorUIResource [UI] ToggleButton.disabledBackground #e0e0e0 HSL 0 0 88 javax.swing.plaf.ColorUIResource [UI] ToggleButton.disabledSelectedBackground #44dd44 HSL 120 69 57 javax.swing.plaf.ColorUIResource [UI] +ToggleButton.disabledSelectedForeground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] ToggleButton.disabledText #000088 HSL 240 100 27 javax.swing.plaf.ColorUIResource [UI] ToggleButton.focusedBackground #00ffff HSL 180 100 50 javax.swing.plaf.ColorUIResource [UI] +ToggleButton.focusedForeground #0000ff HSL 240 100 50 javax.swing.plaf.ColorUIResource [UI] ToggleButton.font [active] $defaultFont [UI] ToggleButton.foreground #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] ToggleButton.highlight #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] ToggleButton.hoverBackground #ffff00 HSL 60 100 50 javax.swing.plaf.ColorUIResource [UI] +ToggleButton.hoverForeground #0000ff HSL 240 100 50 javax.swing.plaf.ColorUIResource [UI] ToggleButton.iconTextGap 4 ToggleButton.light #e3e3e3 HSL 0 0 89 javax.swing.plaf.ColorUIResource [UI] ToggleButton.margin 2,14,2,14 javax.swing.plaf.InsetsUIResource [UI] ToggleButton.pressedBackground #ffc800 HSL 47 100 50 javax.swing.plaf.ColorUIResource [UI] +ToggleButton.pressedForeground #0080ff HSL 210 100 50 javax.swing.plaf.ColorUIResource [UI] ToggleButton.rollover true ToggleButton.selectedBackground #44ff44 HSL 120 100 63 javax.swing.plaf.ColorUIResource [UI] ToggleButton.selectedForeground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] @@ -1302,9 +1320,14 @@ ToggleButton.tab.underlineColor #ffff00 HSL 60 100 50 javax.swing.plaf.Col ToggleButton.tab.underlineHeight 2 ToggleButton.textIconGap 4 ToggleButton.textShiftOffset 0 +ToggleButton.toolbar.disabledSelectedBackground #cccccc HSL 0 0 80 javax.swing.plaf.ColorUIResource [UI] +ToggleButton.toolbar.disabledSelectedForeground #886666 HSL 0 14 47 javax.swing.plaf.ColorUIResource [UI] ToggleButton.toolbar.hoverBackground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] +ToggleButton.toolbar.hoverForeground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] ToggleButton.toolbar.pressedBackground #eeeeee HSL 0 0 93 javax.swing.plaf.ColorUIResource [UI] +ToggleButton.toolbar.pressedForeground #666666 HSL 0 0 40 javax.swing.plaf.ColorUIResource [UI] ToggleButton.toolbar.selectedBackground #dddddd HSL 0 0 87 javax.swing.plaf.ColorUIResource [UI] +ToggleButton.toolbar.selectedForeground #880000 HSL 0 100 27 javax.swing.plaf.ColorUIResource [UI] ToggleButtonUI com.formdev.flatlaf.ui.FlatToggleButtonUI 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 28e9c599..43999d22 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 @@ -78,9 +78,15 @@ controlDkShadow = #696969 Button.startBackground = #fff Button.endBackground = #bbb Button.focusedBackground = #0ff +Button.focusedForeground = #00f Button.hoverBackground = #ff0 +Button.hoverForeground = #00f Button.pressedBackground = #FFC800 +Button.pressedForeground = #0080ff Button.selectedBackground = #fbb +Button.selectedForeground = #321 +Button.disabledSelectedBackground = #123 +Button.disabledSelectedForeground = #fcc Button.borderColor = #0f0 Button.startBorderColor = #00f @@ -95,8 +101,11 @@ Button.default.startBackground = #ddd Button.default.endBackground = #888 Button.default.foreground = #800 Button.default.focusedBackground = #0ff +Button.default.focusedForeground = #00f Button.default.hoverBackground = #ff0 +Button.default.hoverForeground = #00f Button.default.pressedBackground = #FFC800 +Button.default.pressedForeground = #0080ff Button.default.startBorderColor = #f00 Button.default.endBorderColor = #00f Button.default.hoverBorderColor = #f00 @@ -104,8 +113,13 @@ Button.default.focusedBorderColor = #537699 Button.default.focusColor = #f00 Button.toolbar.hoverBackground = #fff +Button.toolbar.hoverForeground = #000 Button.toolbar.pressedBackground = #eee +Button.toolbar.pressedForeground = #666 Button.toolbar.selectedBackground = #ddd +Button.toolbar.selectedForeground = #800 +Button.toolbar.disabledSelectedBackground = #ccc +Button.toolbar.disabledSelectedForeground = #866 #---- CheckBox ---- @@ -422,12 +436,23 @@ ToggleButton.background = #ddf ToggleButton.selectedBackground = #4f4 ToggleButton.selectedForeground = #000 ToggleButton.disabledSelectedBackground = #4d4 +ToggleButton.disabledSelectedForeground = #fff ToggleButton.focusedBackground = #0ff +ToggleButton.focusedForeground = #00f ToggleButton.hoverBackground = #ff0 +ToggleButton.hoverForeground = #00f ToggleButton.pressedBackground = #FFC800 +ToggleButton.pressedForeground = #0080ff +ToggleButton.toolbar.hoverBackground = #fff +ToggleButton.toolbar.hoverForeground = #000 +ToggleButton.toolbar.pressedBackground = #eee +ToggleButton.toolbar.pressedForeground = #666 ToggleButton.toolbar.selectedBackground = #ddd +ToggleButton.toolbar.selectedForeground = #800 +ToggleButton.toolbar.disabledSelectedBackground = #ccc +ToggleButton.toolbar.disabledSelectedForeground = #866 #---- ToolBar ---- 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 e7cdd3b8..84e62024 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 @@ -23,10 +23,13 @@ Button.default.endBorderColor Button.default.focusColor Button.default.focusedBackground Button.default.focusedBorderColor +Button.default.focusedForeground Button.default.foreground Button.default.hoverBackground Button.default.hoverBorderColor +Button.default.hoverForeground Button.default.pressedBackground +Button.default.pressedForeground Button.default.startBackground Button.default.startBorderColor Button.defaultButtonFollowsFocus @@ -34,23 +37,27 @@ Button.disabledBackground Button.disabledBorderColor Button.disabledForeground Button.disabledSelectedBackground +Button.disabledSelectedForeground Button.disabledText Button.endBackground Button.endBorderColor Button.focusInputMap Button.focusedBackground Button.focusedBorderColor +Button.focusedForeground Button.font Button.foreground Button.highlight Button.hoverBackground Button.hoverBorderColor +Button.hoverForeground Button.iconTextGap Button.innerFocusWidth Button.light Button.margin Button.minimumWidth Button.pressedBackground +Button.pressedForeground Button.rollover Button.selectedBackground Button.selectedForeground @@ -59,10 +66,15 @@ Button.startBackground Button.startBorderColor Button.textIconGap Button.textShiftOffset +Button.toolbar.disabledSelectedBackground +Button.toolbar.disabledSelectedForeground Button.toolbar.hoverBackground +Button.toolbar.hoverForeground Button.toolbar.margin Button.toolbar.pressedBackground +Button.toolbar.pressedForeground Button.toolbar.selectedBackground +Button.toolbar.selectedForeground Button.toolbar.spacingInsets ButtonUI Caret.width @@ -1001,17 +1013,21 @@ ToggleButton.border ToggleButton.darkShadow ToggleButton.disabledBackground ToggleButton.disabledSelectedBackground +ToggleButton.disabledSelectedForeground ToggleButton.disabledText ToggleButton.focusInputMap ToggleButton.focusedBackground +ToggleButton.focusedForeground ToggleButton.font ToggleButton.foreground ToggleButton.highlight ToggleButton.hoverBackground +ToggleButton.hoverForeground ToggleButton.iconTextGap ToggleButton.light ToggleButton.margin ToggleButton.pressedBackground +ToggleButton.pressedForeground ToggleButton.rollover ToggleButton.selectedBackground ToggleButton.selectedForeground @@ -1024,9 +1040,14 @@ ToggleButton.tab.underlineColor ToggleButton.tab.underlineHeight ToggleButton.textIconGap ToggleButton.textShiftOffset +ToggleButton.toolbar.disabledSelectedBackground +ToggleButton.toolbar.disabledSelectedForeground ToggleButton.toolbar.hoverBackground +ToggleButton.toolbar.hoverForeground ToggleButton.toolbar.pressedBackground +ToggleButton.toolbar.pressedForeground ToggleButton.toolbar.selectedBackground +ToggleButton.toolbar.selectedForeground ToggleButtonUI ToolBar.ancestorInputMap ToolBar.arrowKeysOnlyNavigation