From d9c240d72971b49e567cfe277d24ec84dee53193 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Sat, 10 Apr 2021 12:46:13 +0200 Subject: [PATCH] DesktopPane: fixed incomplete minimized icon when switching LaF --- CHANGELOG.md | 5 +++-- .../com/formdev/flatlaf/ui/FlatDesktopIconUI.java | 11 ++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7d462dd..71d5420b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,8 +16,9 @@ FlatLaf Change Log #### Fixed bugs -- DesktopPane: Fixed empty minimized icon when using a custom desktop manager. - (PR #294) +- DesktopPane: + - Fixed empty minimized icon when using a custom desktop manager. (PR #294) + - Fixed incomplete minimized icon when switching LaF. ## 1.1.2 diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatDesktopIconUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatDesktopIconUI.java index 51382592..338a4294 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatDesktopIconUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatDesktopIconUI.java @@ -246,13 +246,22 @@ public class FlatDesktopIconUI } } + // layout internal frame title pane, which was recreated when switching Laf + // (directly invoke doLayout() because frame.validate() does not work here + // because frame is not displayable) + if( !frame.isValid() ) + frame.doLayout(); + for( Component c : frame.getComponents() ) { + if( !c.isValid() ) + c.doLayout(); + } + // paint internal frame to buffered image int frameWidth = Math.max( frame.getWidth(), 1 ); int frameHeight = Math.max( frame.getHeight(), 1 ); BufferedImage frameImage = new BufferedImage( frameWidth, frameHeight, BufferedImage.TYPE_INT_ARGB ); Graphics2D g = frameImage.createGraphics(); try { - //TODO fix missing internal frame header when switching LaF frame.paint( g ); } finally { g.dispose();