mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 15:07:11 -06:00
Window decorations: fixed exception in SwingUtilities.convertPoint() when doing new JDialog( (Window) null )
regression since commits54e6cefa67andfb37be5734
This commit is contained in:
@@ -224,6 +224,11 @@ public class FlatTitlePane
|
||||
restoreButton = createButton( "TitlePane.restoreIcon", "Restore", e -> restore() );
|
||||
closeButton = createButton( "TitlePane.closeIcon", "Close", e -> close() );
|
||||
|
||||
// initially hide buttons that are only supported in frames
|
||||
iconifyButton.setVisible( false );
|
||||
maximizeButton.setVisible( false );
|
||||
restoreButton.setVisible( false );
|
||||
|
||||
buttonPanel = new JPanel() {
|
||||
@Override
|
||||
public Dimension getPreferredSize() {
|
||||
@@ -243,11 +248,9 @@ public class FlatTitlePane
|
||||
if( rootPane.getWindowDecorationStyle() == JRootPane.FRAME ) {
|
||||
// JRootPane.FRAME works only for frames (and not for dialogs)
|
||||
// but at this time the owner window type is unknown (not yet added)
|
||||
// so we add the iconify/maximize/restore buttons and they are hidden
|
||||
// so we add the iconify/maximize/restore buttons and they are shown
|
||||
// later in frameStateChanged(), which is invoked from addNotify()
|
||||
|
||||
restoreButton.setVisible( false );
|
||||
|
||||
buttonPanel.add( iconifyButton );
|
||||
buttonPanel.add( maximizeButton );
|
||||
buttonPanel.add( restoreButton );
|
||||
@@ -813,7 +816,7 @@ debug*/
|
||||
}
|
||||
|
||||
private Rectangle boundsInWindow( JComponent c ) {
|
||||
return c.isVisible()
|
||||
return c.isShowing()
|
||||
? SwingUtilities.convertRectangle( c.getParent(), c.getBounds(), window )
|
||||
: null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user