File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/main/java/org/scijava/ui/swing/script Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -988,7 +988,12 @@ public void loadPreferences() {
988988
989989 final int windowWidth = prefService .getInt (getClass (), WINDOW_WIDTH , dim .width );
990990 final int windowHeight = prefService .getInt (getClass (), WINDOW_HEIGHT , dim .height );
991- setPreferredSize (new Dimension (windowWidth , windowHeight ));
991+ // Avoid creating a window larger than the desktop
992+ final Dimension screen = Toolkit .getDefaultToolkit ().getScreenSize ();
993+ if (windowWidth > screen .getWidth () || windowHeight > screen .getHeight ())
994+ setPreferredSize (new Dimension (DEFAULT_WINDOW_WIDTH , DEFAULT_WINDOW_HEIGHT ));
995+ else
996+ setPreferredSize (new Dimension (windowWidth , windowHeight ));
992997
993998 final int mainDivLocation = prefService .getInt (getClass (), MAIN_DIV_LOCATION , body .getDividerLocation ());
994999 body .setDividerLocation (mainDivLocation );
You can’t perform that action at this time.
0 commit comments