mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 06:20:53 +03:00
InternalFrame: fixed translucent internal frame menu bar background if TitlePane.unifiedBackground is true (issue #274)
This commit is contained in:
@@ -16,6 +16,8 @@ FlatLaf Change Log
|
||||
`frame.setVisible(true)`. (issue #277)
|
||||
- Custom window decorations: Fixed NPE in `FlatTitlePane.findHorizontalGlue()`.
|
||||
(issue #275)
|
||||
- InternalFrame: Fixed translucent internal frame menu bar background if
|
||||
`TitlePane.unifiedBackground` is `true`. (issue #274)
|
||||
|
||||
|
||||
## 1.1
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.formdev.flatlaf.ui;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.ActionEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.ActionMap;
|
||||
@@ -86,7 +87,7 @@ public class FlatMenuBarUI
|
||||
|
||||
@Override
|
||||
public void update( Graphics g, JComponent c ) {
|
||||
// do not fill background if menubar is embedded into title pane
|
||||
// paint background
|
||||
if( isFillBackground( c ) ) {
|
||||
g.setColor( c.getBackground() );
|
||||
g.fillRect( 0, 0, c.getWidth(), c.getHeight() );
|
||||
@@ -96,21 +97,25 @@ public class FlatMenuBarUI
|
||||
}
|
||||
|
||||
protected boolean isFillBackground( JComponent c ) {
|
||||
// paint background in opaque or having custom background color
|
||||
// paint background if opaque or if having custom background color
|
||||
if( c.isOpaque() || !(c.getBackground() instanceof UIResource) )
|
||||
return true;
|
||||
|
||||
// paint background if menu bar is not the "main" menu bar
|
||||
JRootPane rootPane = SwingUtilities.getRootPane( c );
|
||||
if( rootPane == null || !(rootPane.getParent() instanceof Window) || rootPane.getJMenuBar() != c )
|
||||
return true;
|
||||
|
||||
// do not paint background for unified title pane
|
||||
if( unifiedBackground )
|
||||
return false;
|
||||
|
||||
// paint background in full screen mode
|
||||
JRootPane rootPane = SwingUtilities.getRootPane( c );
|
||||
if( rootPane == null || FlatUIUtils.isFullScreen( rootPane ) )
|
||||
if( FlatUIUtils.isFullScreen( rootPane ) )
|
||||
return true;
|
||||
|
||||
// do not paint background if menu bar is embedded into title pane
|
||||
return rootPane.getJMenuBar() != c || !FlatRootPaneUI.isMenuBarEmbedded( rootPane );
|
||||
return !FlatRootPaneUI.isMenuBarEmbedded( rootPane );
|
||||
}
|
||||
|
||||
//---- class TakeFocus ----------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user