Native window decorations: avoid double window title bar if enabling native window border failed (issue #315)

This commit is contained in:
Karl Tauber
2021-04-23 21:12:40 +02:00
parent 9fe0cf496b
commit 067501cbe7
2 changed files with 10 additions and 0 deletions

View File

@@ -125,6 +125,10 @@ public class FlatNativeWindowBorder
// enable native window border for window
setHasCustomDecoration( frame, true );
// avoid double window title bar if enabling native window border failed
if( !hasCustomDecoration( frame ) )
return;
// enable Swing window decoration
rootPane.setWindowDecorationStyle( JRootPane.FRAME );
@@ -143,6 +147,10 @@ public class FlatNativeWindowBorder
// enable native window border for window
setHasCustomDecoration( dialog, true );
// avoid double window title bar if enabling native window border failed
if( !hasCustomDecoration( dialog ) )
return;
// enable Swing window decoration
rootPane.setWindowDecorationStyle( JRootPane.PLAIN_DIALOG );
}

View File

@@ -308,6 +308,8 @@ class FlatWindowsNativeWindowBorder
this.window = window;
hwnd = installImpl( window );
if( hwnd == 0 )
return;
// remove the OS window title bar
if( window instanceof JFrame && ((JFrame)window).getExtendedState() != 0 ) {