mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 05:50:53 +03:00
Window decorations: glass pane no longer overlaps the FlatLaf window title bar (issue #630)
This commit is contained in:
@@ -5,8 +5,11 @@ FlatLaf Change Log
|
||||
|
||||
#### Fixed bugs
|
||||
|
||||
- FlatLaf window decorations on Linux: Fixed broken window resizing on
|
||||
multi-screen setups. (issue #632)
|
||||
- FlatLaf window decorations:
|
||||
- Fixed inconsistent size of glass pane depending on whether FlatLaf window
|
||||
decorations are used (e.g. Windows 10/11) or not (e.g. macOS). Now the glass
|
||||
pane no longer overlaps the FlatLaf window title bar. (issue #630)
|
||||
- Linux: Fixed broken window resizing on multi-screen setups. (issue #632)
|
||||
- IntelliJ Themes:
|
||||
- Fixed default button hover background in "Solarized Light" theme. (issue
|
||||
#628)
|
||||
|
||||
@@ -442,6 +442,17 @@ public interface FlatClientProperties
|
||||
*/
|
||||
String TITLE_BAR_FOREGROUND = "JRootPane.titleBarForeground";
|
||||
|
||||
/**
|
||||
* Specifies whether the glass pane should have full height and overlap the title bar,
|
||||
* if FlatLaf window decorations are enabled. Default is {@code false}.
|
||||
* <p>
|
||||
* <strong>Component</strong> {@link javax.swing.JRootPane}<br>
|
||||
* <strong>Value type</strong> {@link java.lang.Boolean}
|
||||
*
|
||||
* @since 3.1
|
||||
*/
|
||||
String GLASS_PANE_FULL_HEIGHT = "JRootPane.glassPaneFullHeight";
|
||||
|
||||
//---- JScrollBar / JScrollPane -------------------------------------------
|
||||
|
||||
/**
|
||||
|
||||
@@ -362,6 +362,10 @@ public class FlatRootPaneUI
|
||||
if( titlePane != null )
|
||||
titlePane.titleBarColorsChanged();
|
||||
break;
|
||||
|
||||
case FlatClientProperties.GLASS_PANE_FULL_HEIGHT:
|
||||
rootPane.revalidate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,11 +446,11 @@ public class FlatRootPaneUI
|
||||
int width = rootPane.getWidth() - insets.left - insets.right;
|
||||
int height = rootPane.getHeight() - insets.top - insets.bottom;
|
||||
|
||||
// layered pane
|
||||
if( rootPane.getLayeredPane() != null )
|
||||
rootPane.getLayeredPane().setBounds( x, y, width, height );
|
||||
if( rootPane.getGlassPane() != null )
|
||||
rootPane.getGlassPane().setBounds( x, y, width, height );
|
||||
|
||||
// title pane
|
||||
int nextY = 0;
|
||||
if( titlePane != null ) {
|
||||
int prefHeight = !isFullScreen ? titlePane.getPreferredSize().height : 0;
|
||||
@@ -454,6 +458,15 @@ public class FlatRootPaneUI
|
||||
nextY += prefHeight;
|
||||
}
|
||||
|
||||
// glass pane
|
||||
if( rootPane.getGlassPane() != null ) {
|
||||
boolean fullHeight = FlatClientProperties.clientPropertyBoolean(
|
||||
rootPane, FlatClientProperties.GLASS_PANE_FULL_HEIGHT, false );
|
||||
int offset = fullHeight ? 0 : nextY;
|
||||
rootPane.getGlassPane().setBounds( x, y + offset, width, height - offset );
|
||||
}
|
||||
|
||||
// menu bar
|
||||
JMenuBar menuBar = rootPane.getJMenuBar();
|
||||
if( menuBar != null && menuBar.isVisible() ) {
|
||||
boolean embedded = !isFullScreen && titlePane != null && titlePane.isMenuBarEmbedded();
|
||||
@@ -467,10 +480,12 @@ public class FlatRootPaneUI
|
||||
}
|
||||
}
|
||||
|
||||
// content pane
|
||||
Container contentPane = rootPane.getContentPane();
|
||||
if( contentPane != null )
|
||||
contentPane.setBounds( 0, nextY, width, Math.max( height - nextY, 0 ) );
|
||||
|
||||
// title pane
|
||||
if( titlePane != null )
|
||||
titlePane.menuBarLayouted();
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ public class FlatInspector
|
||||
private Window window;
|
||||
|
||||
private boolean enabled;
|
||||
private Object oldGlassPaneFullHeight;
|
||||
private Component lastComponent;
|
||||
private int lastX;
|
||||
private int lastY;
|
||||
@@ -258,6 +259,14 @@ public class FlatInspector
|
||||
|
||||
this.enabled = enabled;
|
||||
|
||||
// make sure that glass pane has full height if enabled
|
||||
if( enabled ) {
|
||||
oldGlassPaneFullHeight = rootPane.getClientProperty( FlatClientProperties.GLASS_PANE_FULL_HEIGHT );
|
||||
rootPane.putClientProperty( FlatClientProperties.GLASS_PANE_FULL_HEIGHT, true );
|
||||
rootPane.validate();
|
||||
} else
|
||||
rootPane.putClientProperty( FlatClientProperties.GLASS_PANE_FULL_HEIGHT, oldGlassPaneFullHeight );
|
||||
|
||||
// make sure that glass pane is not opaque, which is not the case in WebLaF
|
||||
((JComponent)rootPane.getGlassPane()).setOpaque( false );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user