mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-08 06:50:56 +03:00
Window decorations: enable dark window appearance on macOS when running in JetBrains Runtime (issues #47 and #82)
This commit is contained in:
@@ -41,6 +41,7 @@ import javax.swing.plaf.ComponentUI;
|
|||||||
import javax.swing.plaf.UIResource;
|
import javax.swing.plaf.UIResource;
|
||||||
import javax.swing.plaf.basic.BasicRootPaneUI;
|
import javax.swing.plaf.basic.BasicRootPaneUI;
|
||||||
import com.formdev.flatlaf.FlatClientProperties;
|
import com.formdev.flatlaf.FlatClientProperties;
|
||||||
|
import com.formdev.flatlaf.FlatLaf;
|
||||||
import com.formdev.flatlaf.util.HiDPIUtils;
|
import com.formdev.flatlaf.util.HiDPIUtils;
|
||||||
import com.formdev.flatlaf.util.SystemInfo;
|
import com.formdev.flatlaf.util.SystemInfo;
|
||||||
|
|
||||||
@@ -97,6 +98,13 @@ public class FlatRootPaneUI
|
|||||||
if( background == null || background instanceof UIResource )
|
if( background == null || background instanceof UIResource )
|
||||||
parent.setBackground( UIManager.getColor( "control" ) );
|
parent.setBackground( UIManager.getColor( "control" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// enable dark window appearance on macOS when running in JetBrains Runtime
|
||||||
|
if( SystemInfo.IS_JETBRAINS_JVM && SystemInfo.IS_MAC_OS_10_14_MOJAVE ) {
|
||||||
|
LookAndFeel laf = UIManager.getLookAndFeel();
|
||||||
|
boolean isDark = laf instanceof FlatLaf && ((FlatLaf)laf).isDark();
|
||||||
|
c.putClientProperty( "jetbrains.awt.windowDarkAppearance", isDark );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void installClientDecorations() {
|
private void installClientDecorations() {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ public class SystemInfo
|
|||||||
// OS versions
|
// OS versions
|
||||||
public static final boolean IS_WINDOWS_10_OR_LATER;
|
public static final boolean IS_WINDOWS_10_OR_LATER;
|
||||||
public static final boolean IS_MAC_OS_10_11_EL_CAPITAN_OR_LATER;
|
public static final boolean IS_MAC_OS_10_11_EL_CAPITAN_OR_LATER;
|
||||||
|
public static final boolean IS_MAC_OS_10_14_MOJAVE;
|
||||||
public static final boolean IS_MAC_OS_10_15_CATALINA_OR_LATER;
|
public static final boolean IS_MAC_OS_10_15_CATALINA_OR_LATER;
|
||||||
|
|
||||||
// Java versions
|
// Java versions
|
||||||
@@ -58,6 +59,7 @@ public class SystemInfo
|
|||||||
long osVersion = scanVersion( System.getProperty( "os.version" ) );
|
long osVersion = scanVersion( System.getProperty( "os.version" ) );
|
||||||
IS_WINDOWS_10_OR_LATER = (IS_WINDOWS && osVersion >= toVersion( 10, 0, 0, 0 ));
|
IS_WINDOWS_10_OR_LATER = (IS_WINDOWS && osVersion >= toVersion( 10, 0, 0, 0 ));
|
||||||
IS_MAC_OS_10_11_EL_CAPITAN_OR_LATER = (IS_MAC && osVersion >= toVersion( 10, 11, 0, 0 ));
|
IS_MAC_OS_10_11_EL_CAPITAN_OR_LATER = (IS_MAC && osVersion >= toVersion( 10, 11, 0, 0 ));
|
||||||
|
IS_MAC_OS_10_14_MOJAVE = (IS_MAC && osVersion >= toVersion( 10, 14, 0, 0 ));
|
||||||
IS_MAC_OS_10_15_CATALINA_OR_LATER = (IS_MAC && osVersion >= toVersion( 10, 15, 0, 0 ));
|
IS_MAC_OS_10_15_CATALINA_OR_LATER = (IS_MAC && osVersion >= toVersion( 10, 15, 0, 0 ));
|
||||||
|
|
||||||
// Java versions
|
// Java versions
|
||||||
|
|||||||
Reference in New Issue
Block a user