From 0eb77c7f72f725fbc8e676171d6dbac677951287 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Fri, 31 May 2024 11:55:39 +0200 Subject: [PATCH] Theme Editor: fixed occasional empty window on startup on macOS --- CHANGELOG.md | 1 + .../formdev/flatlaf/themeeditor/FlatThemeFileEditor.java | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a22d288b..b0712606 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ FlatLaf Change Log ``, `` and `` in HTML text for components Button, CheckBox, RadioButton, MenuItem (and subclasses), JideLabel, JideButton, JXBusyLabel and JXHyperlink. Also fixed for Label and ToolTip if using Java 11+. +- Theme Editor: Fixed occasional empty window on startup on macOS. #### Incompatibilities diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java index aa8ba9d4..315b3da5 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java @@ -929,6 +929,12 @@ class FlatThemeFileEditor y = Math.max( Math.min( y, r.height - h ), r.y ); } + // On macOS, the window may be empty if it spans the whole screen height + // and client property apple.awt.fullWindowContent is set to true. + // Invoking addNotify() before setting window bounds fixes this issue. + if( SystemInfo.isMacOS && !isDisplayable() ) + addNotify(); + setBounds( x, y, w, h ); return; } catch( NumberFormatException ex ) {