diff --git a/CHANGELOG.md b/CHANGELOG.md index ed79e0fd..35c460d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ FlatLaf Change Log ## 3.7.1-SNAPSHOT +- ComboBox: Added UI property `ComboBox.buttonFocusedEditableBackground`. (issue + #1068) - Popup: Fixed scrolling popup painting issue on Windows 10 when a glass pane is visible and frame is maximized. (issue #1071) diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatComboBoxUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatComboBoxUI.java index 2f135bca..7ac3fa89 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatComboBoxUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatComboBoxUI.java @@ -113,6 +113,7 @@ import com.formdev.flatlaf.util.SystemInfo; * @uiDefault ComboBox.buttonBackground Color optional * @uiDefault ComboBox.buttonEditableBackground Color optional * @uiDefault ComboBox.buttonFocusedBackground Color optional; defaults to ComboBox.focusedBackground + * @uiDefault ComboBox.buttonFocusedEditableBackground Color optional; defaults to ComboBox.buttonEditableBackground * @uiDefault ComboBox.buttonSeparatorWidth int or float optional; defaults to Component.borderWidth * @uiDefault ComboBox.buttonSeparatorColor Color optional * @uiDefault ComboBox.buttonDisabledSeparatorColor Color optional @@ -147,6 +148,7 @@ public class FlatComboBoxUI @Styleable protected Color buttonBackground; @Styleable protected Color buttonEditableBackground; @Styleable protected Color buttonFocusedBackground; + /** @since 3.7.1 */ @Styleable protected Color buttonFocusedEditableBackground; /** @since 2 */ @Styleable protected float buttonSeparatorWidth; /** @since 2 */ @Styleable protected Color buttonSeparatorColor; /** @since 2 */ @Styleable protected Color buttonDisabledSeparatorColor; @@ -258,6 +260,7 @@ public class FlatComboBoxUI buttonBackground = UIManager.getColor( "ComboBox.buttonBackground" ); buttonFocusedBackground = UIManager.getColor( "ComboBox.buttonFocusedBackground" ); + buttonFocusedEditableBackground = UIManager.getColor( "ComboBox.buttonFocusedEditableBackground" ); buttonEditableBackground = UIManager.getColor( "ComboBox.buttonEditableBackground" ); buttonSeparatorWidth = FlatUIUtils.getUIFloat( "ComboBox.buttonSeparatorWidth", FlatUIUtils.getUIFloat( "Component.borderWidth", 1 ) ); buttonSeparatorColor = UIManager.getColor( "ComboBox.buttonSeparatorColor" ); @@ -293,6 +296,7 @@ public class FlatComboBoxUI buttonBackground = null; buttonEditableBackground = null; buttonFocusedBackground = null; + buttonFocusedEditableBackground = null; buttonSeparatorColor = null; buttonDisabledSeparatorColor = null; buttonArrowColor = null; @@ -587,7 +591,7 @@ public class FlatComboBoxUI // paint arrow button background if( enabled && !isCellRenderer && arrowButton.isVisible() ) { Color buttonColor = paintButton - ? buttonEditableBackground + ? (buttonFocusedEditableBackground != null && isPermanentFocusOwner( comboBox ) ? buttonFocusedEditableBackground : buttonEditableBackground) : (buttonFocusedBackground != null || focusedBackground != null) && isPermanentFocusOwner( comboBox ) ? (buttonFocusedBackground != null ? buttonFocusedBackground : focusedBackground) : buttonBackground; 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 704f7c14..0c77e895 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 @@ -199,8 +199,9 @@ public class TestFlatStyleableInfo "disabledForeground", Color.class, "buttonBackground", Color.class, - "buttonFocusedBackground", Color.class, "buttonEditableBackground", Color.class, + "buttonFocusedBackground", Color.class, + "buttonFocusedEditableBackground", Color.class, "buttonSeparatorWidth", float.class, "buttonSeparatorColor", Color.class, "buttonDisabledSeparatorColor", Color.class, diff --git a/flatlaf-core/src/test/java/com/formdev/flatlaf/ui/TestFlatStyleableValue.java b/flatlaf-core/src/test/java/com/formdev/flatlaf/ui/TestFlatStyleableValue.java index c3b6d946..1be5ff3b 100644 --- a/flatlaf-core/src/test/java/com/formdev/flatlaf/ui/TestFlatStyleableValue.java +++ b/flatlaf-core/src/test/java/com/formdev/flatlaf/ui/TestFlatStyleableValue.java @@ -388,8 +388,9 @@ public class TestFlatStyleableValue testColor( c, ui, "disabledForeground" ); testColor( c, ui, "buttonBackground" ); - testColor( c, ui, "buttonFocusedBackground" ); testColor( c, ui, "buttonEditableBackground" ); + testColor( c, ui, "buttonFocusedBackground" ); + testColor( c, ui, "buttonFocusedEditableBackground" ); testFloat( c, ui, "buttonSeparatorWidth" ); testColor( c, ui, "buttonSeparatorColor" ); testColor( c, ui, "buttonDisabledSeparatorColor" ); diff --git a/flatlaf-testing/dumps/styleable-infos.txt b/flatlaf-testing/dumps/styleable-infos.txt index 21d743ee..039337ff 100644 --- a/flatlaf-testing/dumps/styleable-infos.txt +++ b/flatlaf-testing/dumps/styleable-infos.txt @@ -184,6 +184,7 @@ buttonDisabledArrowColor java.awt.Color buttonDisabledSeparatorColor java.awt.Color buttonEditableBackground java.awt.Color buttonFocusedBackground java.awt.Color +buttonFocusedEditableBackground java.awt.Color buttonHoverArrowColor java.awt.Color buttonPressedArrowColor java.awt.Color buttonSeparatorColor java.awt.Color diff --git a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0.txt b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0.txt index 230e340d..a0eb8c07 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0.txt @@ -235,6 +235,7 @@ ComboBox.buttonDisabledArrowColor #ababab HSL 0 0 67 javax.swing.plaf.C ComboBox.buttonDisabledSeparatorColor #000088 HSL 240 100 27 javax.swing.plaf.ColorUIResource [UI] ComboBox.buttonEditableBackground #cccccc HSL 0 0 80 javax.swing.plaf.ColorUIResource [UI] ComboBox.buttonFocusedBackground #ffff00 HSL 60 100 50 javax.swing.plaf.ColorUIResource [UI] +ComboBox.buttonFocusedEditableBackground #ffff44 HSL 60 100 63 javax.swing.plaf.ColorUIResource [UI] ComboBox.buttonHighlight #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] ComboBox.buttonHoverArrowColor #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] ComboBox.buttonPressedArrowColor #0000ff HSL 240 100 50 javax.swing.plaf.ColorUIResource [UI] 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 50a6b72a..babcf85e 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 @@ -182,6 +182,7 @@ ComboBox.buttonEditableBackground = #ccc ComboBox.focusedBackground = #ff8 ComboBox.buttonFocusedBackground = #ff0 +ComboBox.buttonFocusedEditableBackground = #ff4 ComboBox.popupBackground = #ffc 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 d4c750f7..ab328e90 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 @@ -226,6 +226,7 @@ ComboBox.buttonDisabledArrowColor ComboBox.buttonDisabledSeparatorColor ComboBox.buttonEditableBackground ComboBox.buttonFocusedBackground +ComboBox.buttonFocusedEditableBackground ComboBox.buttonHighlight ComboBox.buttonHoverArrowColor ComboBox.buttonPressedArrowColor