JAL-2587 Progress bar sizing tweaks
authorkiramt <k.mourao@dundee.ac.uk>
Fri, 25 Aug 2017 08:41:25 +0000 (09:41 +0100)
committerkiramt <k.mourao@dundee.ac.uk>
Fri, 25 Aug 2017 08:41:25 +0000 (09:41 +0100)
src/jalview/gui/OverviewPanel.java
src/jalview/gui/ProgressPanel.java
src/jalview/renderer/OverviewRenderer.java

index 6e453ba..74c2112 100755 (executable)
@@ -88,7 +88,7 @@ public class OverviewPanel extends JPanel implements Runnable,
 
     setLayout(new BorderLayout());
     progressPanel = new ProgressPanel(OverviewRenderer.UPDATE,
-            MessageManager.getString("label.oview_calc"));
+            MessageManager.getString("label.oview_calc"), getWidth());
     this.add(progressPanel, BorderLayout.SOUTH);
     oviewCanvas = new OverviewCanvas(od, av, progressPanel);
 
index 1f87838..170e9eb 100644 (file)
@@ -24,6 +24,8 @@ import jalview.api.RendererListenerI;
 
 import java.awt.BorderLayout;
 import java.awt.CardLayout;
+import java.awt.Color;
+import java.awt.Dimension;
 import java.beans.PropertyChangeEvent;
 
 import javax.swing.BorderFactory;
@@ -31,7 +33,6 @@ import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JProgressBar;
 import javax.swing.border.EmptyBorder;
-import javax.swing.border.EtchedBorder;
 
 /**
  * A class to manage a panel containing a label and progress bar updated by an
@@ -72,17 +73,28 @@ public class ProgressPanel extends JPanel implements RendererListenerI
    * @param label
    *          The label to place next to the progress bar
    */
-  public ProgressPanel(String eventPropertyName, String label)
+  public ProgressPanel(String eventPropertyName, String label, int maxwidth)
   {
     super(new BorderLayout(10, 0));
-    setBorder(new EmptyBorder(0, 3, 0, 20));
+    setBorder(new EmptyBorder(0, 3, 0, 0));
 
     eventName = eventPropertyName;
     String labelText = label;
 
-    progressBar = new JProgressBar();
+    final int w = maxwidth;
+
+    progressBar = new JProgressBar()
+    {
+      @Override
+      public Dimension getMaximumSize()
+      {
+        return new Dimension(w, 1);
+      }
+    };
     progressBar.setMinimum(0);
+    progressBar.setPreferredSize(progressBar.getMaximumSize());
     progressLabel = new JLabel(labelText);
+    progressLabel.setFont(new java.awt.Font("Verdana", 0, 11));
 
     // Use a CardLayout to stop the progress bar panel moving around when
     // changing visibility
@@ -101,7 +113,8 @@ public class ProgressPanel extends JPanel implements RendererListenerI
     add(barPanel, BorderLayout.CENTER);
     add(new JLabel(" "), BorderLayout.EAST);
 
-    setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
+    setBorder(BorderFactory.createLineBorder(Color.black));
+    // setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
   }
 
   @Override
index eac2745..b9d57a4 100644 (file)
@@ -114,7 +114,6 @@ public class OverviewRenderer
       {
         if (redraw)
         {
-
           break;
         }