mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 15:27:16 -06:00
Demo and Theme Editor: updated macOS related comments
This commit is contained in:
@@ -38,8 +38,8 @@ import com.formdev.flatlaf.FlatLightLaf;
|
|||||||
import com.formdev.flatlaf.demo.HintManager.Hint;
|
import com.formdev.flatlaf.demo.HintManager.Hint;
|
||||||
import com.formdev.flatlaf.demo.extras.*;
|
import com.formdev.flatlaf.demo.extras.*;
|
||||||
import com.formdev.flatlaf.demo.intellijthemes.*;
|
import com.formdev.flatlaf.demo.intellijthemes.*;
|
||||||
import com.formdev.flatlaf.extras.FlatDesktop;
|
|
||||||
import com.formdev.flatlaf.extras.FlatAnimatedLafChange;
|
import com.formdev.flatlaf.extras.FlatAnimatedLafChange;
|
||||||
|
import com.formdev.flatlaf.extras.FlatDesktop;
|
||||||
import com.formdev.flatlaf.extras.FlatSVGIcon;
|
import com.formdev.flatlaf.extras.FlatSVGIcon;
|
||||||
import com.formdev.flatlaf.extras.FlatUIDefaultsInspector;
|
import com.formdev.flatlaf.extras.FlatUIDefaultsInspector;
|
||||||
import com.formdev.flatlaf.extras.components.FlatButton;
|
import com.formdev.flatlaf.extras.components.FlatButton;
|
||||||
@@ -82,16 +82,17 @@ class DemoFrame
|
|||||||
if( tabIndex >= 0 && tabIndex < tabbedPane.getTabCount() && tabIndex != tabbedPane.getSelectedIndex() )
|
if( tabIndex >= 0 && tabIndex < tabbedPane.getTabCount() && tabIndex != tabbedPane.getSelectedIndex() )
|
||||||
tabbedPane.setSelectedIndex( tabIndex );
|
tabbedPane.setSelectedIndex( tabIndex );
|
||||||
|
|
||||||
// hide some menu items on macOS
|
// macOS (see https://www.formdev.com/flatlaf/macos/)
|
||||||
if( SystemInfo.isMacOS ) {
|
if( SystemInfo.isMacOS ) {
|
||||||
|
// hide menu items that are in macOS application menu
|
||||||
exitMenuItem.setVisible( false );
|
exitMenuItem.setVisible( false );
|
||||||
aboutMenuItem.setVisible( false );
|
aboutMenuItem.setVisible( false );
|
||||||
|
|
||||||
// do not use HTML text on macOS
|
// do not use HTML text in menu items because this is not supported in macOS screen menu
|
||||||
htmlMenuItem.setText( "some text" );
|
htmlMenuItem.setText( "some text" );
|
||||||
|
|
||||||
// see https://www.formdev.com/flatlaf/macos/
|
|
||||||
if( SystemInfo.isMacFullWindowContentSupported ) {
|
if( SystemInfo.isMacFullWindowContentSupported ) {
|
||||||
|
// expand window content into window title bar and make title bar transparent
|
||||||
getRootPane().putClientProperty( "apple.awt.fullWindowContent", true );
|
getRootPane().putClientProperty( "apple.awt.fullWindowContent", true );
|
||||||
getRootPane().putClientProperty( "apple.awt.transparentTitleBar", true );
|
getRootPane().putClientProperty( "apple.awt.transparentTitleBar", true );
|
||||||
|
|
||||||
|
|||||||
@@ -36,10 +36,8 @@ public class FlatLafDemo
|
|||||||
static boolean screenshotsMode = Boolean.parseBoolean( System.getProperty( "flatlaf.demo.screenshotsMode" ) );
|
static boolean screenshotsMode = Boolean.parseBoolean( System.getProperty( "flatlaf.demo.screenshotsMode" ) );
|
||||||
|
|
||||||
public static void main( String[] args ) {
|
public static void main( String[] args ) {
|
||||||
// macOS
|
// macOS (see https://www.formdev.com/flatlaf/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" );
|
||||||
|
|||||||
@@ -26,10 +26,8 @@ import com.formdev.flatlaf.util.SystemInfo;
|
|||||||
public class FlatLafThemeEditor
|
public class FlatLafThemeEditor
|
||||||
{
|
{
|
||||||
public static void main( String[] args ) {
|
public static void main( String[] args ) {
|
||||||
// macOS
|
// macOS (see https://www.formdev.com/flatlaf/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" );
|
||||||
|
|||||||
@@ -173,13 +173,14 @@ class FlatThemeFileEditor
|
|||||||
|
|
||||||
enableDisableActions();
|
enableDisableActions();
|
||||||
|
|
||||||
// hide some menu items on macOS
|
// macOS (see https://www.formdev.com/flatlaf/macos/)
|
||||||
if( SystemInfo.isMacOS ) {
|
if( SystemInfo.isMacOS ) {
|
||||||
|
// hide menu items that are in macOS application menu
|
||||||
exitMenuItem.setVisible( false );
|
exitMenuItem.setVisible( false );
|
||||||
aboutMenuItem.setVisible( false );
|
aboutMenuItem.setVisible( false );
|
||||||
|
|
||||||
// see https://www.formdev.com/flatlaf/macos/
|
|
||||||
if( SystemInfo.isMacFullWindowContentSupported ) {
|
if( SystemInfo.isMacFullWindowContentSupported ) {
|
||||||
|
// expand window content into window title bar and make title bar transparent
|
||||||
getRootPane().putClientProperty( "apple.awt.fullWindowContent", true );
|
getRootPane().putClientProperty( "apple.awt.fullWindowContent", true );
|
||||||
getRootPane().putClientProperty( "apple.awt.transparentTitleBar", true );
|
getRootPane().putClientProperty( "apple.awt.transparentTitleBar", true );
|
||||||
|
|
||||||
@@ -195,7 +196,7 @@ class FlatThemeFileEditor
|
|||||||
|
|
||||||
// enable full screen mode for this window (for Java 8 - 10; not necessary for Java 11+)
|
// enable full screen mode for this window (for Java 8 - 10; not necessary for Java 11+)
|
||||||
if( !SystemInfo.isJava_11_orLater )
|
if( !SystemInfo.isJava_11_orLater )
|
||||||
getRootPane().putClientProperty( "apple.awt.fullscreenable", false );
|
getRootPane().putClientProperty( "apple.awt.fullscreenable", true );
|
||||||
}
|
}
|
||||||
|
|
||||||
// integrate into macOS screen menu
|
// integrate into macOS screen menu
|
||||||
|
|||||||
Reference in New Issue
Block a user