mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 06:57:13 -06:00
Window decorations: support enabling/disabling unified title bar backgrounds at runtime without FlatLaf.updateUI()
This commit is contained in:
@@ -53,8 +53,6 @@ import com.formdev.flatlaf.util.SystemInfo;
|
||||
public class FlatMenuBarUI
|
||||
extends BasicMenuBarUI
|
||||
{
|
||||
protected boolean unifiedBackground;
|
||||
|
||||
public static ComponentUI createUI( JComponent c ) {
|
||||
return new FlatMenuBarUI();
|
||||
}
|
||||
@@ -69,8 +67,6 @@ public class FlatMenuBarUI
|
||||
super.installDefaults();
|
||||
|
||||
LookAndFeel.installProperty( menuBar, "opaque", false );
|
||||
|
||||
unifiedBackground = UIManager.getBoolean( "TitlePane.unifiedBackground" );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,7 +103,8 @@ public class FlatMenuBarUI
|
||||
return true;
|
||||
|
||||
// do not paint background for unified title pane
|
||||
if( unifiedBackground )
|
||||
// (not storing value of "TitlePane.unifiedBackground" in class to allow changing at runtime)
|
||||
if( UIManager.getBoolean( "TitlePane.unifiedBackground" ) )
|
||||
return false;
|
||||
|
||||
// paint background in full screen mode
|
||||
|
||||
@@ -105,7 +105,6 @@ public class FlatTitlePane
|
||||
protected final Color embeddedForeground = UIManager.getColor( "TitlePane.embeddedForeground" );
|
||||
protected final Color borderColor = UIManager.getColor( "TitlePane.borderColor" );
|
||||
|
||||
protected final boolean unifiedBackground = UIManager.getBoolean( "TitlePane.unifiedBackground" );
|
||||
protected final Dimension iconSize = UIManager.getDimension( "TitlePane.iconSize" );
|
||||
protected final int buttonMaximizedHeight = UIManager.getInt( "TitlePane.buttonMaximizedHeight" );
|
||||
protected final boolean centerTitle = UIManager.getBoolean( "TitlePane.centerTitle" );
|
||||
@@ -523,7 +522,8 @@ debug*/
|
||||
|
||||
@Override
|
||||
protected void paintComponent( Graphics g ) {
|
||||
if( !unifiedBackground ) {
|
||||
// not storing value of "TitlePane.unifiedBackground" in class to allow changing at runtime
|
||||
if( !UIManager.getBoolean( "TitlePane.unifiedBackground" ) ) {
|
||||
g.setColor( getBackground() );
|
||||
g.fillRect( 0, 0, getWidth(), getHeight() );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user