mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 14:00:55 +03:00
Theme Editor: on macOS use apple.awt.fullWindowContent and apple.awt.transparentTitleBar
This commit is contained in:
@@ -105,8 +105,9 @@ class DemoFrame
|
||||
toolBar.add( Box.createHorizontalStrut( 70 ), 0 );
|
||||
}
|
||||
|
||||
// enable full screen mode for this window
|
||||
getRootPane().putClientProperty( "apple.awt.fullscreenable", true );
|
||||
// enable full screen mode for this window (for Java 8 - 10; not necessary for Java 11+)
|
||||
if( !SystemInfo.isJava_11_orLater )
|
||||
getRootPane().putClientProperty( "apple.awt.fullscreenable", true );
|
||||
}
|
||||
|
||||
// integrate into macOS screen menu
|
||||
|
||||
@@ -28,6 +28,8 @@ public class FlatLafThemeEditor
|
||||
public static void main( String[] args ) {
|
||||
// macOS
|
||||
if( SystemInfo.isMacOS ) {
|
||||
// see https://www.formdev.com/flatlaf/macos/
|
||||
|
||||
// enable screen menu bar
|
||||
// (moves menu bar from JFrame window to top of screen)
|
||||
System.setProperty( "apple.laf.useScreenMenuBar", "true" );
|
||||
@@ -41,6 +43,7 @@ public class FlatLafThemeEditor
|
||||
// - "system": use current macOS appearance (light or dark)
|
||||
// - "NSAppearanceNameAqua": use light appearance
|
||||
// - "NSAppearanceNameDarkAqua": use dark appearance
|
||||
// (needs to be set on main thread; setting it on AWT thread does not work)
|
||||
System.setProperty( "apple.awt.application.appearance", "system" );
|
||||
}
|
||||
|
||||
|
||||
@@ -177,6 +177,25 @@ class FlatThemeFileEditor
|
||||
if( SystemInfo.isMacOS ) {
|
||||
exitMenuItem.setVisible( false );
|
||||
aboutMenuItem.setVisible( false );
|
||||
|
||||
// see https://www.formdev.com/flatlaf/macos/
|
||||
if( SystemInfo.isMacFullWindowContentSupported ) {
|
||||
getRootPane().putClientProperty( "apple.awt.fullWindowContent", true );
|
||||
getRootPane().putClientProperty( "apple.awt.transparentTitleBar", true );
|
||||
|
||||
// hide window title
|
||||
if( SystemInfo.isJava_17_orLater )
|
||||
getRootPane().putClientProperty( "apple.awt.windowTitleVisible", false );
|
||||
else
|
||||
setTitle( null );
|
||||
|
||||
// add gap to left side of toolbar
|
||||
controlPanel.add( Box.createHorizontalStrut( 70 ), 0 );
|
||||
}
|
||||
|
||||
// enable full screen mode for this window (for Java 8 - 10; not necessary for Java 11+)
|
||||
if( !SystemInfo.isJava_11_orLater )
|
||||
getRootPane().putClientProperty( "apple.awt.fullscreenable", false );
|
||||
}
|
||||
|
||||
// integrate into macOS screen menu
|
||||
|
||||
Reference in New Issue
Block a user