From e2a9bdae8dceb5ca97fe8be3f5c7d71b335ee234 Mon Sep 17 00:00:00 2001 From: kiramt Date: Tue, 8 Aug 2017 15:03:17 +0100 Subject: [PATCH] JAL-2587 tidies --- src/jalview/gui/OverviewPanel.java | 37 ++++-------------------------------- src/jalview/gui/ProgressPanel.java | 9 ++++++--- 2 files changed, 10 insertions(+), 36 deletions(-) diff --git a/src/jalview/gui/OverviewPanel.java b/src/jalview/gui/OverviewPanel.java index af80725..791de99 100755 --- a/src/jalview/gui/OverviewPanel.java +++ b/src/jalview/gui/OverviewPanel.java @@ -86,7 +86,7 @@ public class OverviewPanel extends JPanel implements Runnable, (av.isShowAnnotation() && av .getAlignmentConservationAnnotation() != null)); - setSize(od.getWidth(), od.getHeight()); + setLayout(new BorderLayout()); progressPanel = new ProgressPanel(OverviewRenderer.UPDATE, @@ -95,7 +95,7 @@ public class OverviewPanel extends JPanel implements Runnable, oviewCanvas = new OverviewCanvas(od, av, progressPanel); add(oviewCanvas, BorderLayout.CENTER); - + setSize(od.getWidth(), od.getHeight()); av.getRanges().addPropertyChangeListener(this); @@ -272,15 +272,14 @@ public class OverviewPanel extends JPanel implements Runnable, od.setHeight(getHeight()); } - setPreferredSize(new Dimension(od.getWidth(), od.getHeight())); + setPreferredSize(new Dimension(od.getWidth(), + od.getHeight())); if (oviewCanvas.restartDraw()) { return; } - // oviewCanvas.addPropertyChangeListener(OverviewRenderer.UPDATE, this); - Thread thread = new Thread(this); thread.start(); repaint(); @@ -333,32 +332,4 @@ public class OverviewPanel extends JPanel implements Runnable, od = null; } } - - /* private void addProgressBar() - { - progressPanel = new JPanel(new BorderLayout(10, 0)); - progressPanel.setBorder(new EmptyBorder(0, 3, 0, 20)); - - this.add(progressPanel, BorderLayout.SOUTH); - - progressBar = new OvProgressBar(); - progressBar.setMinimum(0); - - progressPanel.add(new JLabel("Recalculating overview..."), - BorderLayout.WEST); - progressPanel.add(progressBar, BorderLayout.CENTER); - } - - private void removeProgressBar() - { - if (progressPanel != null) - { - synchronized (progressPanel) - { - progressPanel.remove(progressBar); - this.remove(progressPanel); - progressPanel = null; - } - } - }*/ } diff --git a/src/jalview/gui/ProgressPanel.java b/src/jalview/gui/ProgressPanel.java index f69f0cf..6a70f6a 100644 --- a/src/jalview/gui/ProgressPanel.java +++ b/src/jalview/gui/ProgressPanel.java @@ -49,6 +49,8 @@ public class ProgressPanel extends JPanel implements RendererListenerI private JLabel progressLabel; + private String labelText; + /** * Construct a JPanel containing a progress bar and a label. * @@ -63,10 +65,11 @@ public class ProgressPanel extends JPanel implements RendererListenerI setBorder(new EmptyBorder(0, 3, 0, 20)); eventName = eventPropertyName; + labelText = label; progressBar = new JProgressBar(); progressBar.setMinimum(0); - progressLabel = new JLabel(label); + progressLabel = new JLabel(labelText); add(progressLabel, BorderLayout.WEST); add(progressBar, BorderLayout.CENTER); @@ -89,12 +92,12 @@ public class ProgressPanel extends JPanel implements RendererListenerI if (progress < MAXVALUE && !progressBar.isVisible()) { progressBar.setVisible(true); - progressLabel.setVisible(true); + progressLabel.setText(labelText); } else if (progress >= MAXVALUE) { progressBar.setVisible(false); - progressLabel.setVisible(false); + progressLabel.setText(" "); // keep visible so panel stays visible } } } -- 1.7.10.2