diff --git a/CHANGELOG.md b/CHANGELOG.md index 6be1d41f..b5f40480 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ FlatLaf Change Log - Native window decorations: Support disabling native window decorations per window. (set client property `JRootPane.useWindowDecorations` to `false` on root pane). +- Support running on WinPE. (issue #279) #### Fixed bugs diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java index cf626a79..1ac47041 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java @@ -157,7 +157,7 @@ public abstract class FlatLaf */ @Override public boolean getSupportsWindowDecorations() { - if( SystemInfo.isProjector ) + if( SystemInfo.isProjector || SystemInfo.isWinPE ) return false; if( SystemInfo.isWindows_10_orLater && @@ -443,7 +443,10 @@ public abstract class FlatLaf FontUIResource uiFont = null; if( SystemInfo.isWindows ) { - Font winFont = (Font) Toolkit.getDefaultToolkit().getDesktopProperty( "win.messagebox.font" ); + // on WinPE use "win.defaultGUI.font", which is usually Tahoma, + // because Segoe UI font is not available on WinPE + Font winFont = (Font) Toolkit.getDefaultToolkit().getDesktopProperty( + SystemInfo.isWinPE ? "win.defaultGUI.font" : "win.messagebox.font" ); if( winFont != null ) uiFont = createCompositeFont( winFont.getFamily(), winFont.getStyle(), winFont.getSize() ); diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatNativeWindowBorder.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatNativeWindowBorder.java index d76ea198..22e1d2e4 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatNativeWindowBorder.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatNativeWindowBorder.java @@ -242,8 +242,8 @@ public class FlatNativeWindowBorder if( !SystemInfo.isWindows_10_orLater ) return; - // do not use when running in JetBrains Projector - if( SystemInfo.isProjector ) + // do not use when running in JetBrains Projector or WinPE + if( SystemInfo.isProjector || SystemInfo.isWinPE ) return; // check whether disabled via system property diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/util/SystemInfo.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/util/SystemInfo.java index d4524479..c193425e 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/util/SystemInfo.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/util/SystemInfo.java @@ -56,6 +56,7 @@ public class SystemInfo // other /** @since 1.1 */ public static final boolean isProjector; + /** @since 1.1.1 */ public static final boolean isWinPE; static { // platforms @@ -91,6 +92,7 @@ public class SystemInfo // other isProjector = Boolean.getBoolean( "org.jetbrains.projector.server.enable" ); + isWinPE = isWindows && "X:\\Windows\\System32".equalsIgnoreCase( System.getProperty( "user.dir" ) ); } public static long scanVersion( String version ) {