From fffa2f18ae739a49d6ff165a80bf4a3bd8f95e7f Mon Sep 17 00:00:00 2001 From: weisj Date: Sat, 12 Oct 2019 00:33:02 +0200 Subject: [PATCH] TabbedPane no longer tries to end dragging when not appropriate. --- src/main/java/com/weis/darklaf/ui/tabbedpane/DarkHandler.java | 4 +++- .../weis/darklaf/ui/tabbedpane/DarkScrollableTabSupport.java | 1 - .../weis/darklaf/ui/tabbedpane/DarkScrollableTabViewport.java | 1 - .../darklaf/ui/tabbedpane/DarkTabbedPaneScrollLayout.java | 1 - src/main/java/com/weis/darklaf/util/ColorUtil.java | 4 ++++ 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/weis/darklaf/ui/tabbedpane/DarkHandler.java b/src/main/java/com/weis/darklaf/ui/tabbedpane/DarkHandler.java index 298bb2ea..38160445 100644 --- a/src/main/java/com/weis/darklaf/ui/tabbedpane/DarkHandler.java +++ b/src/main/java/com/weis/darklaf/ui/tabbedpane/DarkHandler.java @@ -243,7 +243,9 @@ public class DarkHandler extends TabbedPaneHandler { @Override public void mouseReleased(final MouseEvent e) { super.mouseReleased(e); - stopDrag(e); + if (ui.dragging && ui.scrollableTabLayoutEnabled()) { + stopDrag(e); + } } @Override diff --git a/src/main/java/com/weis/darklaf/ui/tabbedpane/DarkScrollableTabSupport.java b/src/main/java/com/weis/darklaf/ui/tabbedpane/DarkScrollableTabSupport.java index 8d75416a..ff5262b8 100644 --- a/src/main/java/com/weis/darklaf/ui/tabbedpane/DarkScrollableTabSupport.java +++ b/src/main/java/com/weis/darklaf/ui/tabbedpane/DarkScrollableTabSupport.java @@ -25,7 +25,6 @@ package com.weis.darklaf.ui.tabbedpane; import com.weis.darklaf.components.ScrollPopupMenu; import com.weis.darklaf.decorators.PopupMenuAdapter; -import com.weis.darklaf.ui.tabbedpane.bridge.ScrollableTabSupport; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/com/weis/darklaf/ui/tabbedpane/DarkScrollableTabViewport.java b/src/main/java/com/weis/darklaf/ui/tabbedpane/DarkScrollableTabViewport.java index bc8cba2d..bc53b7fa 100644 --- a/src/main/java/com/weis/darklaf/ui/tabbedpane/DarkScrollableTabViewport.java +++ b/src/main/java/com/weis/darklaf/ui/tabbedpane/DarkScrollableTabViewport.java @@ -23,7 +23,6 @@ */ package com.weis.darklaf.ui.tabbedpane; -import com.weis.darklaf.ui.tabbedpane.bridge.ScrollableTabViewport; import org.jetbrains.annotations.NotNull; import java.awt.*; diff --git a/src/main/java/com/weis/darklaf/ui/tabbedpane/DarkTabbedPaneScrollLayout.java b/src/main/java/com/weis/darklaf/ui/tabbedpane/DarkTabbedPaneScrollLayout.java index aa5ee99b..f9c20595 100644 --- a/src/main/java/com/weis/darklaf/ui/tabbedpane/DarkTabbedPaneScrollLayout.java +++ b/src/main/java/com/weis/darklaf/ui/tabbedpane/DarkTabbedPaneScrollLayout.java @@ -23,7 +23,6 @@ */ package com.weis.darklaf.ui.tabbedpane; -import com.weis.darklaf.ui.tabbedpane.bridge.TabbedPaneScrollLayout; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/com/weis/darklaf/util/ColorUtil.java b/src/main/java/com/weis/darklaf/util/ColorUtil.java index baf483e1..e723dda6 100644 --- a/src/main/java/com/weis/darklaf/util/ColorUtil.java +++ b/src/main/java/com/weis/darklaf/util/ColorUtil.java @@ -88,4 +88,8 @@ public final class ColorUtil { } } + @NotNull + public static Color removeAlpha(final Color color) { + return toAlpha(color, 255); + } }