diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatMenuBarUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatMenuBarUI.java index 42fc745e..d5e34fe7 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatMenuBarUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatMenuBarUI.java @@ -106,18 +106,18 @@ public class FlatMenuBarUI if( rootPane == null || !(rootPane.getParent() instanceof Window) || rootPane.getJMenuBar() != c ) return background; - // paint background for unified title pane in color of parent + // use parent background for unified title pane // (not storing value of "TitlePane.unifiedBackground" in class to allow changing at runtime) if( UIManager.getBoolean( "TitlePane.unifiedBackground" ) && FlatNativeWindowBorder.hasCustomDecoration( (Window) rootPane.getParent() ) ) - return FlatUIUtils.getParentBackground( c ); + background = FlatUIUtils.getParentBackground( c ); // paint background in full screen mode if( FlatUIUtils.isFullScreen( rootPane ) ) return background; // do not paint background if menu bar is embedded into title pane - return FlatRootPaneUI.isMenuBarEmbedded( rootPane ) ? null :background; + return FlatRootPaneUI.isMenuBarEmbedded( rootPane ) ? null : background; } //---- class TakeFocus ---------------------------------------------------- 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 15565d06..ef5baa1c 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 @@ -16,6 +16,7 @@ package com.formdev.flatlaf.ui; +import static com.formdev.flatlaf.FlatClientProperties.*; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -265,8 +266,8 @@ public class FlatTitlePane } protected void activeChanged( boolean active ) { - Color background = FlatClientProperties.clientPropertyColor( rootPane, FlatClientProperties.TITLE_BAR_BACKGROUND, null ); - Color foreground = FlatClientProperties.clientPropertyColor( rootPane, FlatClientProperties.TITLE_BAR_FOREGROUND, null ); + Color background = clientPropertyColor( rootPane, TITLE_BAR_BACKGROUND, null ); + Color foreground = clientPropertyColor( rootPane, TITLE_BAR_FOREGROUND, null ); Color titleForeground = foreground; if( background == null ) background = FlatUIUtils.nonUIResource( active ? activeBackground : inactiveBackground ); @@ -537,7 +538,8 @@ debug*/ @Override protected void paintComponent( Graphics g ) { // not storing value of "TitlePane.unifiedBackground" in class to allow changing at runtime - g.setColor( UIManager.getBoolean( "TitlePane.unifiedBackground" ) + g.setColor( (UIManager.getBoolean( "TitlePane.unifiedBackground" ) && + clientPropertyColor( rootPane, TITLE_BAR_BACKGROUND, null ) == null) ? FlatUIUtils.getParentBackground( this ) : getBackground() ); g.fillRect( 0, 0, getWidth(), getHeight() );