Browse Source

Button now shows pressed state regardless of isRollover().

Buttons now don't steal default state by default.

Signed-off-by: weisj <weisj@arcor.de>
pull/46/head
weisj 5 years ago
parent
commit
b8150f1e84
  1. 6
      core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java
  2. 2
      core/src/main/resources/com/github/weisj/darklaf/properties/ui/button.properties

6
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) { protected Color getBackgroundColor(final JComponent c) {
boolean defaultButton = isDefaultButton(c); boolean defaultButton = isDefaultButton(c);
boolean rollOver = (c instanceof JButton && (((JButton) c).isRolloverEnabled() boolean rollOver = c instanceof JButton && (((JButton) c).isRolloverEnabled()
&& (((JButton) c).getModel().isRollover()))); && (((JButton) c).getModel().isRollover()));
boolean clicked = rollOver && ((JButton) c).getModel().isArmed(); boolean clicked = c instanceof JButton && (((JButton) c).getModel().isArmed());
if (c.isEnabled()) { if (c.isEnabled()) {
if (defaultButton) { if (defaultButton) {
if (clicked) { if (clicked) {

2
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.hover = %hoverHighlight
Button.shadow.click = %clickHighlight Button.shadow.click = %clickHighlight
defaultButtonFollowFocus = false

Loading…
Cancel
Save