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
|
#### 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
|
- InternalFrame: Fill background to avoid that parent may shine through internal
|
||||||
frame if it contains non-opaque components. (better fix for issue #274)
|
frame if it contains non-opaque components. (better fix for issue #274)
|
||||||
|
|
||||||
|
|||||||
@@ -180,11 +180,15 @@ public class FlatMenuBarUI
|
|||||||
protected Color getBackground( JComponent c ) {
|
protected Color getBackground( JComponent c ) {
|
||||||
Color background = c.getBackground();
|
Color background = c.getBackground();
|
||||||
|
|
||||||
// paint background if opaque or if having custom background color
|
// paint background if opaque
|
||||||
if( c.isOpaque() || !(background instanceof UIResource) )
|
if( c.isOpaque() )
|
||||||
return background;
|
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 );
|
JRootPane rootPane = SwingUtilities.getRootPane( c );
|
||||||
if( rootPane == null || !(rootPane.getParent() instanceof Window) || rootPane.getJMenuBar() != c )
|
if( rootPane == null || !(rootPane.getParent() instanceof Window) || rootPane.getJMenuBar() != c )
|
||||||
return background;
|
return background;
|
||||||
|
|||||||
Reference in New Issue
Block a user