JAL-2536 Overview window sizing not subject to min size restrictions
[jalview.git] / src / jalview / gui / Desktop.java
index 7d0eb7f..b669ebf 100644 (file)
@@ -129,6 +129,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements
         DropTargetListener, ClipboardOwner, IProgressIndicator,
         jalview.api.StructureSelectionManagerProvider
 {
+  private static int DEFAULT_MIN_WIDTH = 300;
+
+  private static int DEFAULT_MIN_HEIGHT = 250;
 
   private JalviewChangeSupport changeSupport = new JalviewChangeSupport();
 
@@ -742,7 +745,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
   public static synchronized void addInternalFrame(
           final JInternalFrame frame, String title, int w, int h)
   {
-    addInternalFrame(frame, title, true, w, h, true);
+    addInternalFrame(frame, title, true, w, h, true, false);
   }
 
   /**
@@ -764,7 +767,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
           final JInternalFrame frame, String title, boolean makeVisible,
           int w, int h)
   {
-    addInternalFrame(frame, title, makeVisible, w, h, true);
+    addInternalFrame(frame, title, makeVisible, w, h, true, false);
   }
 
   /**
@@ -785,7 +788,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
           final JInternalFrame frame, String title, int w, int h,
           boolean resizable)
   {
-    addInternalFrame(frame, title, true, w, h, resizable);
+    addInternalFrame(frame, title, true, w, h, resizable, false);
   }
 
   /**
@@ -804,10 +807,12 @@ public class Desktop extends jalview.jbgui.GDesktop implements
    *          height
    * @param resizable
    *          Allow resize
+   * @param ignoreMinSize
+   *          No minimum size is set for the dialog
    */
   public static synchronized void addInternalFrame(
           final JInternalFrame frame, String title, boolean makeVisible,
-          int w, int h, boolean resizable)
+          int w, int h, boolean resizable, boolean ignoreMinSize)
   {
 
     // TODO: allow callers to determine X and Y position of frame (eg. via
@@ -833,6 +838,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements
 
     openFrameCount++;
 
+    if (!ignoreMinSize)
+    {
+      frame.setMinimumSize(new Dimension(DEFAULT_MIN_WIDTH,
+              DEFAULT_MIN_HEIGHT));
+    }
     frame.setVisible(makeVisible);
     frame.setClosable(true);
     frame.setResizable(resizable);