mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 22:10:54 +03:00
MenuBar: do not fill background if non-opaque and having custom background color (issue #409)
This commit is contained in:
@@ -92,6 +92,8 @@ FlatLaf Change Log
|
||||
|
||||
#### Fixed bugs
|
||||
|
||||
- MenuBar: Do not fill background if non-opaque and having custom background
|
||||
color. (issue #409)
|
||||
- InternalFrame: Fill background to avoid that parent may shine through internal
|
||||
frame if it contains non-opaque components. (better fix for issue #274)
|
||||
|
||||
|
||||
@@ -180,11 +180,15 @@ public class FlatMenuBarUI
|
||||
protected Color getBackground( JComponent c ) {
|
||||
Color background = c.getBackground();
|
||||
|
||||
// paint background if opaque or if having custom background color
|
||||
if( c.isOpaque() || !(background instanceof UIResource) )
|
||||
// paint background if opaque
|
||||
if( c.isOpaque() )
|
||||
return background;
|
||||
|
||||
// paint background if menu bar is not the "main" menu bar
|
||||
// do not paint background if non-opaque and having custom background color
|
||||
if( !(background instanceof UIResource) )
|
||||
return null;
|
||||
|
||||
// paint background if menu bar is not the "main" menu bar (e.g. in internal frame)
|
||||
JRootPane rootPane = SwingUtilities.getRootPane( c );
|
||||
if( rootPane == null || !(rootPane.getParent() instanceof Window) || rootPane.getJMenuBar() != c )
|
||||
return background;
|
||||
|
||||
Reference in New Issue
Block a user