From b8150f1e84809fefb006e72d4d03aad2b39cbbd8 Mon Sep 17 00:00:00 2001 From: weisj Date: Mon, 17 Feb 2020 14:31:14 +0100 Subject: [PATCH] Button now shows pressed state regardless of isRollover(). Buttons now don't steal default state by default. Signed-off-by: weisj --- .../com/github/weisj/darklaf/ui/button/DarkButtonUI.java | 6 +++--- .../github/weisj/darklaf/properties/ui/button.properties | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java index e5cc3a8e..5e0626b8 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java @@ -227,9 +227,9 @@ public class DarkButtonUI extends BasicButtonUI implements PropertyChangeListene protected Color getBackgroundColor(final JComponent c) { boolean defaultButton = isDefaultButton(c); - boolean rollOver = (c instanceof JButton && (((JButton) c).isRolloverEnabled() - && (((JButton) c).getModel().isRollover()))); - boolean clicked = rollOver && ((JButton) c).getModel().isArmed(); + boolean rollOver = c instanceof JButton && (((JButton) c).isRolloverEnabled() + && (((JButton) c).getModel().isRollover())); + boolean clicked = c instanceof JButton && (((JButton) c).getModel().isArmed()); if (c.isEnabled()) { if (defaultButton) { if (clicked) { diff --git a/core/src/main/resources/com/github/weisj/darklaf/properties/ui/button.properties b/core/src/main/resources/com/github/weisj/darklaf/properties/ui/button.properties index 1a0e388d..7d37438c 100644 --- a/core/src/main/resources/com/github/weisj/darklaf/properties/ui/button.properties +++ b/core/src/main/resources/com/github/weisj/darklaf/properties/ui/button.properties @@ -57,3 +57,5 @@ Button.fullShadowInsets = 0,0,0,0 Button.shadow.hover = %hoverHighlight Button.shadow.click = %clickHighlight + +defaultButtonFollowFocus = false