mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 15:27:16 -06:00
Window decorations: avoid possible endless restore/maximize in WindowStateListener in case of behavior changes in Java (issue #129)
This commit is contained in:
@@ -250,7 +250,11 @@ public class FlatTitlePane
|
|||||||
maximizeButton.setVisible( resizable && !maximized );
|
maximizeButton.setVisible( resizable && !maximized );
|
||||||
restoreButton.setVisible( resizable && maximized );
|
restoreButton.setVisible( resizable && maximized );
|
||||||
|
|
||||||
if( maximized ) {
|
if( maximized &&
|
||||||
|
rootPane.getClientProperty( "_flatlaf.maximizedBoundsUpToDate" ) == null )
|
||||||
|
{
|
||||||
|
rootPane.putClientProperty( "_flatlaf.maximizedBoundsUpToDate", null );
|
||||||
|
|
||||||
// In case that frame was maximized from custom code (e.g. when restoring
|
// In case that frame was maximized from custom code (e.g. when restoring
|
||||||
// window state on application startup), then maximized bounds is not set
|
// window state on application startup), then maximized bounds is not set
|
||||||
// and the window would overlap Windows task bar.
|
// and the window would overlap Windows task bar.
|
||||||
@@ -439,6 +443,9 @@ public class FlatTitlePane
|
|||||||
|
|
||||||
updateMaximizedBounds();
|
updateMaximizedBounds();
|
||||||
|
|
||||||
|
// let our WindowStateListener know that the maximized bounds are up-to-date
|
||||||
|
rootPane.putClientProperty( "_flatlaf.maximizedBoundsUpToDate", true );
|
||||||
|
|
||||||
// maximize window
|
// maximize window
|
||||||
frame.setExtendedState( frame.getExtendedState() | Frame.MAXIMIZED_BOTH );
|
frame.setExtendedState( frame.getExtendedState() | Frame.MAXIMIZED_BOTH );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user