From 2a9efee3e5409cc02bdd86f3fbfa405881bbe54d Mon Sep 17 00:00:00 2001 From: Jannis Weis <31143295+weisJ@users.noreply.github.com> Date: Sun, 10 Apr 2022 16:37:14 +0200 Subject: [PATCH] Don't paint titlebar border when it isn't opaque --- .../darklaf/platform/macos/ui/MacOSTitlePane.java | 14 +++++++------- .../platform/windows/ui/WindowsTitlePane.java | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSTitlePane.java b/macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSTitlePane.java index 46fd3276..bfdb364f 100644 --- a/macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSTitlePane.java +++ b/macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSTitlePane.java @@ -101,18 +101,18 @@ public class MacOSTitlePane extends CustomTitlePane { @Override public void paintComponent(final Graphics g) { + if (!isOpaque()) return; + int width = getWidth(); int height = getHeight(); - if (isOpaque()) { - Window window = getWindow(); - boolean active = window == null || window.isActive(); + Window window = getWindow(); + boolean active = window == null || window.isActive(); - Color background = active ? activeBackground : inactiveBackground; + Color background = active ? activeBackground : inactiveBackground; - g.setColor(background); - g.fillRect(0, 0, width, height); - } + g.setColor(background); + g.fillRect(0, 0, width, height); if (!hideTitleBar()) { g.setColor(border); diff --git a/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java index fd08f526..7a91af8f 100644 --- a/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java +++ b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java @@ -486,11 +486,11 @@ public class WindowsTitlePane extends CustomTitlePane { g.setColor(background); g.fillRect(0, 0, width, height); - } - if (isDrawBorder()) { - g.setColor(border); - g.fillRect(0, height - 1, width, 1); + if (isDrawBorder()) { + g.setColor(border); + g.fillRect(0, height - 1, width, 1); + } } GraphicsConfiguration currentGC = getGraphicsConfiguration();