JAL-845 restore SplitFrame size from project; enable Find in SplitFrame
[jalview.git] / src / jalview / jbgui / GSplitFrame.java
index 374972c..a377571 100644 (file)
@@ -1,7 +1,5 @@
 package jalview.jbgui;
 
-import jalview.util.Platform;
-
 import java.awt.Component;
 import java.awt.MouseInfo;
 import java.awt.Point;
@@ -11,6 +9,8 @@ import javax.swing.JInternalFrame;
 import javax.swing.JSplitPane;
 import javax.swing.plaf.basic.BasicInternalFrameUI;
 
+import jalview.util.Platform;
+
 public class GSplitFrame extends JInternalFrame
 {
   private static final long serialVersionUID = 1L;
@@ -45,8 +45,10 @@ public class GSplitFrame extends JInternalFrame
     splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topFrame,
             bottomFrame);
     splitPane.setVisible(true);
-    splitPane.setDividerLocation(0.5d);
-    splitPane.setResizeWeight(0.5d);
+    final double ratio = topFrame.getHeight()
+            / (double) (topFrame.getHeight() + bottomFrame.getHeight());
+    splitPane.setDividerLocation(ratio);
+    splitPane.setResizeWeight(ratio);
     splitPane.setDividerSize(5);
     add(splitPane);
   }
@@ -132,6 +134,7 @@ public class GSplitFrame extends JInternalFrame
     if (show)
     {
       // SplitPane needs nudging to restore 50-50 split
+      // TODO save/restore other ratios
       splitPane.setDividerLocation(0.5d);
     }
     validate();