diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b649dae..a14f29bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ FlatLaf Change Log #### Fixed bugs - Fixed crash when running in Webswing. (issue #290) +- Native window decorations: Removed superfluous pixel-line at top of screen + when window is maximized. (issue #296) ## 1.1.1 diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTitlePane.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTitlePane.java index 845c1aa0..05a0cb1c 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTitlePane.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTitlePane.java @@ -803,7 +803,7 @@ debug*/ } else if( borderColor != null && (rootPane.getJMenuBar() == null || !rootPane.getJMenuBar().isVisible()) ) insets.bottom += UIScale.scale( 1 ); - if( hasNativeCustomDecoration() ) + if( hasNativeCustomDecoration() && !isWindowMaximized( c ) ) insets = FlatUIUtils.addInsets( insets, WindowTopBorder.getInstance().getBorderInsets() ); return insets; @@ -822,7 +822,7 @@ debug*/ FlatUIUtils.paintFilledRectangle( g, borderColor, x, y + height - lineHeight, width, lineHeight ); } - if( hasNativeCustomDecoration() ) + if( hasNativeCustomDecoration() && !isWindowMaximized( c ) ) WindowTopBorder.getInstance().paintBorder( c, g, x, y, width, height ); } @@ -830,6 +830,12 @@ debug*/ JMenuBar menuBar = rootPane.getJMenuBar(); return hasVisibleEmbeddedMenuBar( menuBar ) ? menuBar.getBorder() : null; } + + protected boolean isWindowMaximized( Component c ) { + return window instanceof Frame + ? (((Frame)window).getExtendedState() & Frame.MAXIMIZED_BOTH) != 0 + : false; + } } //---- class FlatTitleLabelUI ---------------------------------------------