mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-08 23:08:42 +03:00
Window decorations: nested class FlatRootPaneUI.FlatRootLayout is no longer static (issues #47 and #82)
This commit is contained in:
@@ -131,7 +131,7 @@ public class FlatRootPaneUI
|
|||||||
|
|
||||||
//---- class FlatRootLayout -----------------------------------------------
|
//---- class FlatRootLayout -----------------------------------------------
|
||||||
|
|
||||||
private static class FlatRootLayout
|
private class FlatRootLayout
|
||||||
implements LayoutManager2
|
implements LayoutManager2
|
||||||
{
|
{
|
||||||
@Override public void addLayoutComponent( String name, Component comp ) {}
|
@Override public void addLayoutComponent( String name, Component comp ) {}
|
||||||
@@ -155,7 +155,6 @@ public class FlatRootPaneUI
|
|||||||
|
|
||||||
private Dimension computeLayoutSize( Container parent, Function<Component, Dimension> getSizeFunc ) {
|
private Dimension computeLayoutSize( Container parent, Function<Component, Dimension> getSizeFunc ) {
|
||||||
JRootPane rootPane = (JRootPane) parent;
|
JRootPane rootPane = (JRootPane) parent;
|
||||||
FlatTitlePane titlePane = getTitlePane( rootPane );
|
|
||||||
|
|
||||||
Dimension titlePaneSize = (titlePane != null)
|
Dimension titlePaneSize = (titlePane != null)
|
||||||
? getSizeFunc.apply( titlePane )
|
? getSizeFunc.apply( titlePane )
|
||||||
@@ -182,13 +181,6 @@ public class FlatRootPaneUI
|
|||||||
height + insets.top + insets.bottom );
|
height + insets.top + insets.bottom );
|
||||||
}
|
}
|
||||||
|
|
||||||
private FlatTitlePane getTitlePane( JRootPane rootPane ) {
|
|
||||||
return (rootPane.getWindowDecorationStyle() != JRootPane.NONE &&
|
|
||||||
rootPane.getUI() instanceof FlatRootPaneUI)
|
|
||||||
? ((FlatRootPaneUI)rootPane.getUI()).titlePane
|
|
||||||
: null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void layoutContainer( Container parent ) {
|
public void layoutContainer( Container parent ) {
|
||||||
JRootPane rootPane = (JRootPane) parent;
|
JRootPane rootPane = (JRootPane) parent;
|
||||||
@@ -205,7 +197,6 @@ public class FlatRootPaneUI
|
|||||||
rootPane.getGlassPane().setBounds( x, y, width, height );
|
rootPane.getGlassPane().setBounds( x, y, width, height );
|
||||||
|
|
||||||
int nextY = 0;
|
int nextY = 0;
|
||||||
FlatTitlePane titlePane = getTitlePane( rootPane );
|
|
||||||
if( titlePane != null ) {
|
if( titlePane != null ) {
|
||||||
Dimension prefSize = titlePane.getPreferredSize();
|
Dimension prefSize = titlePane.getPreferredSize();
|
||||||
titlePane.setBounds( 0, 0, width, prefSize.height );
|
titlePane.setBounds( 0, 0, width, prefSize.height );
|
||||||
@@ -231,7 +222,6 @@ public class FlatRootPaneUI
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidateLayout( Container parent ) {
|
public void invalidateLayout( Container parent ) {
|
||||||
FlatTitlePane titlePane = getTitlePane( (JRootPane) parent );
|
|
||||||
if( titlePane != null && titlePane.isMenuBarEmbedded() )
|
if( titlePane != null && titlePane.isMenuBarEmbedded() )
|
||||||
titlePane.menuBarChanged();
|
titlePane.menuBarChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user