mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 23:07:15 -06:00
Window decorations: title bar was not hidden if window is in full-screen mode (issue #212)
This commit is contained in:
@@ -285,6 +285,7 @@ public class FlatRootPaneUI
|
||||
@Override
|
||||
public void layoutContainer( Container parent ) {
|
||||
JRootPane rootPane = (JRootPane) parent;
|
||||
boolean isFullScreen = FlatUIUtils.isFullScreen( rootPane );
|
||||
|
||||
Insets insets = rootPane.getInsets();
|
||||
int x = insets.left;
|
||||
@@ -298,7 +299,7 @@ public class FlatRootPaneUI
|
||||
rootPane.getGlassPane().setBounds( x, y, width, height );
|
||||
|
||||
int nextY = 0;
|
||||
if( titlePane != null ) {
|
||||
if( !isFullScreen && titlePane != null ) {
|
||||
Dimension prefSize = titlePane.getPreferredSize();
|
||||
titlePane.setBounds( 0, 0, width, prefSize.height );
|
||||
nextY += prefSize.height;
|
||||
@@ -306,7 +307,7 @@ public class FlatRootPaneUI
|
||||
|
||||
JMenuBar menuBar = rootPane.getJMenuBar();
|
||||
if( menuBar != null && menuBar.isVisible() ) {
|
||||
if( titlePane != null && titlePane.isMenuBarEmbedded() ) {
|
||||
if( !isFullScreen && titlePane != null && titlePane.isMenuBarEmbedded() ) {
|
||||
titlePane.validate();
|
||||
menuBar.setBounds( titlePane.getMenuBarBounds() );
|
||||
} else {
|
||||
|
||||
@@ -23,11 +23,14 @@ import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GraphicsDevice;
|
||||
import java.awt.Insets;
|
||||
import java.awt.KeyboardFocusManager;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.Shape;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
@@ -181,6 +184,16 @@ public class FlatUIUtils
|
||||
keyboardFocusManager.getActiveWindow() == SwingUtilities.windowForComponent( c );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the given component is in a window that is in full-screen mode.
|
||||
*/
|
||||
public static boolean isFullScreen( Component c ) {
|
||||
GraphicsConfiguration gc = c.getGraphicsConfiguration();
|
||||
GraphicsDevice gd = (gc != null) ? gc.getDevice() : null;
|
||||
Window fullScreenWindow = (gd != null) ? gd.getFullScreenWindow() : null;
|
||||
return (fullScreenWindow != null && fullScreenWindow == SwingUtilities.windowForComponent( c ));
|
||||
}
|
||||
|
||||
public static Boolean isRoundRect( Component c ) {
|
||||
return (c instanceof JComponent)
|
||||
? FlatClientProperties.clientPropertyBooleanStrict(
|
||||
|
||||
@@ -256,6 +256,8 @@ public abstract class FlatWindowResizer
|
||||
|
||||
@Override
|
||||
protected boolean isWindowResizable() {
|
||||
if( FlatUIUtils.isFullScreen( resizeComp ) )
|
||||
return false;
|
||||
if( window instanceof Frame )
|
||||
return ((Frame)window).isResizable() && (((Frame)window).getExtendedState() & Frame.MAXIMIZED_BOTH) == 0;
|
||||
if( window instanceof Dialog )
|
||||
@@ -429,9 +431,9 @@ public abstract class FlatWindowResizer
|
||||
protected void paintComponent( Graphics g ) {
|
||||
super.paintChildren( g );
|
||||
|
||||
// this is necessary because Dialog.setResizable() does not fire events
|
||||
if( isDialog() )
|
||||
updateVisibility();
|
||||
// for dialogs: necessary because Dialog.setResizable() does not fire events
|
||||
// for frames: necessary because GraphicsDevice.setFullScreenWindow() does not fire events
|
||||
updateVisibility();
|
||||
|
||||
/*debug
|
||||
int width = getWidth();
|
||||
|
||||
Reference in New Issue
Block a user