InternalFrame: title pane height was too small when iconify, maximize and close buttons are hidden (issue #132)

This commit is contained in:
Karl Tauber
2020-07-21 18:23:57 +02:00
parent 008ecabd21
commit 797830ff96
2 changed files with 17 additions and 1 deletions

View File

@@ -5,6 +5,8 @@ FlatLaf Change Log
- Custom window decorations: Fixed maximized window bounds when programmatically
maximizing window. E.g. restoring window state at startup. (issue #129)
- InternalFrame: Title pane height was too small when iconify, maximize and close
buttons are hidden. (issue #132)
## 0.38

View File

@@ -92,7 +92,21 @@ public class FlatInternalFrameTitlePane
updateFrameIcon();
updateColors();
buttonPanel = new JPanel();
buttonPanel = new JPanel() {
@Override
public Dimension getPreferredSize() {
Dimension size = super.getPreferredSize();
int height = size.height;
// use height of invisible buttons to always have same title pane height
if( !iconButton.isVisible() )
height = Math.max( height, iconButton.getPreferredSize().height );
if( !maxButton.isVisible() )
height = Math.max( height, maxButton.getPreferredSize().height );
if( !closeButton.isVisible() )
height = Math.max( height, closeButton.getPreferredSize().height );
return new Dimension( size.width, height );
}
};
buttonPanel.setLayout( new BoxLayout( buttonPanel, BoxLayout.LINE_AXIS ) );
buttonPanel.setOpaque( false );