JAL-2587 first tweaks to change overview update
authorkiramt <k.mourao@dundee.ac.uk>
Wed, 19 Jul 2017 14:26:55 +0000 (15:26 +0100)
committerkiramt <k.mourao@dundee.ac.uk>
Wed, 19 Jul 2017 14:26:55 +0000 (15:26 +0100)
src/jalview/gui/OverviewCanvas.java
src/jalview/gui/OverviewPanel.java

index 27f9c3f..468deb1 100644 (file)
@@ -155,6 +155,13 @@ public class OverviewCanvas extends JComponent
   }
 
   @Override
+  public void setSize(int width, int height)
+  {
+    // TODO Auto-generated method stub
+    super.setSize(width, height);
+  }
+
+  @Override
   public void paintComponent(Graphics g)
   {
     if (restart)
@@ -173,16 +180,15 @@ public class OverviewCanvas extends JComponent
     }
     else if (lastMiniMe != null)
     {
-      g.drawImage(lastMiniMe, 0, 0, this);
-      if (lastMiniMe != miniMe)
+      g.drawImage(lastMiniMe, 0, 0, getWidth(), getHeight(), this);
+      /* if (lastMiniMe != miniMe)
       {
         g.setColor(TRANS_GREY);
         g.fillRect(0, 0, getWidth(), getHeight());
-      }
+      }*/
     }
 
     g.setColor(Color.red);
     od.drawBox(g);
   }
-
 }
index 3fa674e..8a76211 100755 (executable)
@@ -96,6 +96,15 @@ public class OverviewPanel extends JPanel implements Runnable,
         if ((getWidth() != od.getWidth())
                 || (getHeight() != (od.getHeight())))
         {
+          if ((getWidth() > 0) && (getHeight() > 0))
+          {
+            od.setWidth(getWidth());
+            od.setHeight(getHeight());
+          }
+
+          setPreferredSize(new Dimension(od.getWidth(), od.getHeight()));
+          setBoxPosition();
+
           updateOverviewImage();
           setBoxPosition();
         }