macOS: improved macOS support of Demo and Theme Editor:

- set application name that is used in screen menu bar
- enable dark window title bars if macOS is in dark mode
This commit is contained in:
Karl Tauber
2021-10-24 17:05:50 +02:00
parent 78cef1b3c7
commit 3facbc0900
3 changed files with 36 additions and 6 deletions

View File

@@ -34,10 +34,24 @@ public class FlatLafDemo
static boolean screenshotsMode = Boolean.parseBoolean( System.getProperty( "flatlaf.demo.screenshotsMode" ) );
public static void main( String[] args ) {
// on macOS enable screen menu bar
if( SystemInfo.isMacOS && System.getProperty( "apple.laf.useScreenMenuBar" ) == null )
// macOS
if( SystemInfo.isMacOS ) {
// enable screen menu bar
// (moves menu bar from JFrame window to top of screen)
System.setProperty( "apple.laf.useScreenMenuBar", "true" );
// application name used in screen menu bar
// (in first menu after the "apple" menu)
System.setProperty( "apple.awt.application.name", "FlatLaf Demo" );
// appearance of window title bars
// possible values:
// - "system": use current macOS appearance (light or dark)
// - "NSAppearanceNameAqua": use light appearance
// - "NSAppearanceNameDarkAqua": use dark appearance
System.setProperty( "apple.awt.application.appearance", "system" );
}
if( FlatLafDemo.screenshotsMode && !SystemInfo.isJava_9_orLater && System.getProperty( "flatlaf.uiScale" ) == null )
System.setProperty( "flatlaf.uiScale", "2x" );