mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 14:30:56 +03:00
Theme Editor: on macOS use apple.awt.fullWindowContent and apple.awt.transparentTitleBar
This commit is contained in:
@@ -105,7 +105,8 @@ class DemoFrame
|
|||||||
toolBar.add( Box.createHorizontalStrut( 70 ), 0 );
|
toolBar.add( Box.createHorizontalStrut( 70 ), 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable full screen mode for this window
|
// 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 );
|
getRootPane().putClientProperty( "apple.awt.fullscreenable", true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ public class FlatLafThemeEditor
|
|||||||
public static void main( String[] args ) {
|
public static void main( String[] args ) {
|
||||||
// macOS
|
// macOS
|
||||||
if( SystemInfo.isMacOS ) {
|
if( SystemInfo.isMacOS ) {
|
||||||
|
// see https://www.formdev.com/flatlaf/macos/
|
||||||
|
|
||||||
// enable screen menu bar
|
// enable screen menu bar
|
||||||
// (moves menu bar from JFrame window to top of screen)
|
// (moves menu bar from JFrame window to top of screen)
|
||||||
System.setProperty( "apple.laf.useScreenMenuBar", "true" );
|
System.setProperty( "apple.laf.useScreenMenuBar", "true" );
|
||||||
@@ -41,6 +43,7 @@ public class FlatLafThemeEditor
|
|||||||
// - "system": use current macOS appearance (light or dark)
|
// - "system": use current macOS appearance (light or dark)
|
||||||
// - "NSAppearanceNameAqua": use light appearance
|
// - "NSAppearanceNameAqua": use light appearance
|
||||||
// - "NSAppearanceNameDarkAqua": use dark 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" );
|
System.setProperty( "apple.awt.application.appearance", "system" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -177,6 +177,25 @@ class FlatThemeFileEditor
|
|||||||
if( SystemInfo.isMacOS ) {
|
if( SystemInfo.isMacOS ) {
|
||||||
exitMenuItem.setVisible( false );
|
exitMenuItem.setVisible( false );
|
||||||
aboutMenuItem.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
|
// integrate into macOS screen menu
|
||||||
|
|||||||
Reference in New Issue
Block a user