Window decorations: fixed iconify, maximize and close icon colors if window is inactive

This commit is contained in:
Karl Tauber
2020-08-26 15:03:26 +02:00
parent 3e941e3e42
commit ff214455a3
2 changed files with 9 additions and 4 deletions

View File

@@ -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

View File

@@ -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 );