From ff214455a318ea50801a871d0afc02c4960b4736 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Wed, 26 Aug 2020 15:03:26 +0200 Subject: [PATCH] Window decorations: fixed iconify, maximize and close icon colors if window is inactive --- CHANGELOG.md | 2 ++ .../java/com/formdev/flatlaf/ui/FlatTitlePane.java | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61db7e54..44d85bfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ FlatLaf Change Log changes in the same way as Swing does it for all other text components. (issue #147) - Demo: Fixed restoring last used theme on startup. (regression in 0.39) +- Custom window decorations: Fixed iconify, maximize and close icon colors if + window is inactive. #### Other Changes diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTitlePane.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTitlePane.java index 8ef90297..f86cd12b 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTitlePane.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTitlePane.java @@ -240,12 +240,15 @@ public class FlatTitlePane protected void activeChanged( boolean active ) { boolean hasEmbeddedMenuBar = rootPane.getJMenuBar() != null && isMenuBarEmbedded(); Color background = FlatUIUtils.nonUIResource( active ? activeBackground : inactiveBackground ); - Color foreground = FlatUIUtils.nonUIResource( active - ? (hasEmbeddedMenuBar ? embeddedForeground : activeForeground) - : inactiveForeground ); + Color foreground = FlatUIUtils.nonUIResource( active ? activeForeground : inactiveForeground ); + Color titleForeground = (hasEmbeddedMenuBar && active) ? FlatUIUtils.nonUIResource( embeddedForeground ) : foreground; setBackground( background ); - titleLabel.setForeground( foreground ); + titleLabel.setForeground( titleForeground ); + iconifyButton.setForeground( foreground ); + maximizeButton.setForeground( foreground ); + restoreButton.setForeground( foreground ); + closeButton.setForeground( foreground ); titleLabel.setHorizontalAlignment( hasEmbeddedMenuBar ? SwingConstants.CENTER : SwingConstants.LEADING );