diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerListener.java b/core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerListener.java index db6bee9c..fec5de5f 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerListener.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerListener.java @@ -22,15 +22,13 @@ package com.github.weisj.darklaf.ui.spinner; import java.awt.*; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; +import java.awt.event.*; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import javax.swing.*; +import com.github.weisj.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.PropertyKey; public class DarkSpinnerListener extends MouseAdapter @@ -97,4 +95,16 @@ public class DarkSpinnerListener extends MouseAdapter ui.updateBackground(); } } + + @Override + public void mouseWheelMoved(final MouseWheelEvent e) { + super.mouseWheelMoved(e); + if (!DarkUIUtil.hasFocus(spinner)) return; + int rotation = e.getWheelRotation(); + if (rotation > 0) { + spinner.setValue(spinner.getPreviousValue()); + } else if (rotation < 0) { + spinner.setValue(spinner.getNextValue()); + } + } } diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerUI.java index 65a6c495..b615ace2 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerUI.java @@ -91,6 +91,7 @@ public class DarkSpinnerUI extends BasicSpinnerUI implements SpinnerConstants { super.installListeners(); spinnerListener = createSpinnerListener(); spinner.addMouseListener(spinnerListener); + spinner.addMouseWheelListener(spinnerListener); spinner.addPropertyChangeListener(spinnerListener); } @@ -105,6 +106,7 @@ public class DarkSpinnerUI extends BasicSpinnerUI implements SpinnerConstants { editor.getComponents()[0].removeFocusListener(spinnerListener); } spinner.removeMouseListener(spinnerListener); + spinner.removeMouseWheelListener(spinnerListener); spinner.removePropertyChangeListener(spinnerListener); spinnerListener = null; } diff --git a/core/src/main/resources/com/github/weisj/darklaf/properties/platform/mac.properties b/core/src/main/resources/com/github/weisj/darklaf/properties/platform/mac.properties index f0561d7c..dce9179e 100644 --- a/core/src/main/resources/com/github/weisj/darklaf/properties/platform/mac.properties +++ b/core/src/main/resources/com/github/weisj/darklaf/properties/platform/mac.properties @@ -24,6 +24,7 @@ # # suppress inspection "UnusedProperty" for whole file # +macos.coloredTitleBar = true ScrollBarUI = com.github.weisj.darklaf.ui.scrollpane.DarkMacScrollBarUI ScrollBar.smallWidth = 10 ScrollBar.width = 12