DesktopPane: fixed incomplete minimized icon when switching LaF

This commit is contained in:
Karl Tauber
2021-04-10 12:46:13 +02:00
parent d9526c19e7
commit d9c240d729
2 changed files with 13 additions and 3 deletions

View File

@@ -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

View File

@@ -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();