From 7cf80c29d18c703dfb0f75aa78576537aa43c355 Mon Sep 17 00:00:00 2001 From: Jannis Weis <31143295+weisJ@users.noreply.github.com> Date: Tue, 28 Dec 2021 15:38:43 +0100 Subject: [PATCH] ScrollBar: Hide rounded scrollbar if thumb is empty. If a theme decides to make the minimized scrollbar be size 0 it should be completely hidden. --- .../darklaf/ui/scrollpane/DarkRoundedScrollBarUI.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/DarkRoundedScrollBarUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/DarkRoundedScrollBarUI.java index bf8354e0..ee211b65 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/DarkRoundedScrollBarUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/DarkRoundedScrollBarUI.java @@ -73,10 +73,12 @@ public abstract class DarkRoundedScrollBarUI extends DarkScrollBarUI { } int arc = horizontal ? height : width; roundRect.setRoundRect(x, y, width, height, arc, arc); - g.setColor(getThumbColor()); - g.fill(roundRect); - g.setColor(getThumbBorderColor()); - g.draw(roundRect); + if (!roundRect.isEmpty()) { + g.setColor(getThumbColor()); + g.fill(roundRect); + g.setColor(getThumbBorderColor()); + g.draw(roundRect); + } context.restore(); }