mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 06:57:13 -06:00
Window decorations: not visible menu bar is now ignored in layout
This commit is contained in:
@@ -1,6 +1,13 @@
|
|||||||
FlatLaf Change Log
|
FlatLaf Change Log
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
## 0.44-SNAPSHOT
|
||||||
|
|
||||||
|
#### Fixed bugs
|
||||||
|
|
||||||
|
- Custom window decorations: Not visible menu bar is now ignored in layout.
|
||||||
|
|
||||||
|
|
||||||
## 0.43
|
## 0.43
|
||||||
|
|
||||||
#### New features and improvements
|
#### New features and improvements
|
||||||
|
|||||||
@@ -252,8 +252,9 @@ public class FlatRootPaneUI
|
|||||||
int width = Math.max( titlePaneSize.width, contentSize.width );
|
int width = Math.max( titlePaneSize.width, contentSize.width );
|
||||||
int height = titlePaneSize.height + contentSize.height;
|
int height = titlePaneSize.height + contentSize.height;
|
||||||
if( titlePane == null || !titlePane.isMenuBarEmbedded() ) {
|
if( titlePane == null || !titlePane.isMenuBarEmbedded() ) {
|
||||||
Dimension menuBarSize = (rootPane.getJMenuBar() != null)
|
JMenuBar menuBar = rootPane.getJMenuBar();
|
||||||
? getSizeFunc.apply( rootPane.getJMenuBar() )
|
Dimension menuBarSize = (menuBar != null && menuBar.isVisible())
|
||||||
|
? getSizeFunc.apply( menuBar )
|
||||||
: new Dimension();
|
: new Dimension();
|
||||||
|
|
||||||
width = Math.max( width, menuBarSize.width );
|
width = Math.max( width, menuBarSize.width );
|
||||||
@@ -290,7 +291,7 @@ public class FlatRootPaneUI
|
|||||||
}
|
}
|
||||||
|
|
||||||
JMenuBar menuBar = rootPane.getJMenuBar();
|
JMenuBar menuBar = rootPane.getJMenuBar();
|
||||||
if( menuBar != null ) {
|
if( menuBar != null && menuBar.isVisible() ) {
|
||||||
if( titlePane != null && titlePane.isMenuBarEmbedded() ) {
|
if( titlePane != null && titlePane.isMenuBarEmbedded() ) {
|
||||||
titlePane.validate();
|
titlePane.validate();
|
||||||
menuBar.setBounds( titlePane.getMenuBarBounds() );
|
menuBar.setBounds( titlePane.getMenuBarBounds() );
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ public class FlatTitlePane
|
|||||||
@Override
|
@Override
|
||||||
public Dimension getPreferredSize() {
|
public Dimension getPreferredSize() {
|
||||||
JMenuBar menuBar = rootPane.getJMenuBar();
|
JMenuBar menuBar = rootPane.getJMenuBar();
|
||||||
return (menuBar != null && isMenuBarEmbedded())
|
return (menuBar != null && menuBar.isVisible() && isMenuBarEmbedded())
|
||||||
? FlatUIUtils.addInsets( menuBar.getPreferredSize(), UIScale.scale( menuBarMargins ) )
|
? FlatUIUtils.addInsets( menuBar.getPreferredSize(), UIScale.scale( menuBarMargins ) )
|
||||||
: new Dimension();
|
: new Dimension();
|
||||||
}
|
}
|
||||||
@@ -238,7 +238,7 @@ public class FlatTitlePane
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void activeChanged( boolean active ) {
|
protected void activeChanged( boolean active ) {
|
||||||
boolean hasEmbeddedMenuBar = rootPane.getJMenuBar() != null && isMenuBarEmbedded();
|
boolean hasEmbeddedMenuBar = rootPane.getJMenuBar() != null && rootPane.getJMenuBar().isVisible() && isMenuBarEmbedded();
|
||||||
Color background = FlatUIUtils.nonUIResource( active ? activeBackground : inactiveBackground );
|
Color background = FlatUIUtils.nonUIResource( active ? activeBackground : inactiveBackground );
|
||||||
Color foreground = FlatUIUtils.nonUIResource( active ? activeForeground : inactiveForeground );
|
Color foreground = FlatUIUtils.nonUIResource( active ? activeForeground : inactiveForeground );
|
||||||
Color titleForeground = (hasEmbeddedMenuBar && active) ? FlatUIUtils.nonUIResource( embeddedForeground ) : foreground;
|
Color titleForeground = (hasEmbeddedMenuBar && active) ? FlatUIUtils.nonUIResource( embeddedForeground ) : foreground;
|
||||||
@@ -688,7 +688,7 @@ debug*/
|
|||||||
|
|
||||||
protected Border getMenuBarBorder() {
|
protected Border getMenuBarBorder() {
|
||||||
JMenuBar menuBar = rootPane.getJMenuBar();
|
JMenuBar menuBar = rootPane.getJMenuBar();
|
||||||
return (menuBar != null && isMenuBarEmbedded()) ? menuBar.getBorder() : null;
|
return (menuBar != null && menuBar.isVisible() && isMenuBarEmbedded()) ? menuBar.getBorder() : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user