From ec9cd9c6012125933eacfd5d16680bf3d669a5fd Mon Sep 17 00:00:00 2001 From: Holt59 Date: Wed, 14 Mar 2018 21:30:37 +0100 Subject: [PATCH] Fix issue with ProgressBar for loading graphs. --- .../org/insa/graphics/GraphReaderProgressBar.java | 8 +------- src/main/org/insa/graphics/MainWindow.java | 12 ++++++++---- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/main/org/insa/graphics/GraphReaderProgressBar.java b/src/main/org/insa/graphics/GraphReaderProgressBar.java index 8b0c1f4..98f424f 100644 --- a/src/main/org/insa/graphics/GraphReaderProgressBar.java +++ b/src/main/org/insa/graphics/GraphReaderProgressBar.java @@ -1,7 +1,6 @@ package org.insa.graphics; import java.awt.Component; -import java.awt.Dimension; import javax.swing.Box; import javax.swing.BoxLayout; @@ -38,7 +37,7 @@ public class GraphReaderProgressBar extends JDialog implements GraphReaderObserv private final JProgressBar[] progressBars = new JProgressBar[3]; // Current element read, and modulo. - private int[] counters = new int[]{ 0, 0, 0 }; + private int[] counters = new int[] { 0, 0, 0 }; private int[] modulos = new int[3]; public GraphReaderProgressBar(JFrame owner) { @@ -63,13 +62,8 @@ public class GraphReaderProgressBar extends JDialog implements GraphReaderObserv } pane.add(Box.createVerticalGlue()); - - pane.setPreferredSize(new Dimension(300, 120)); - setContentPane(pane); - pack(); - } @Override diff --git a/src/main/org/insa/graphics/MainWindow.java b/src/main/org/insa/graphics/MainWindow.java index 844840f..04409bf 100644 --- a/src/main/org/insa/graphics/MainWindow.java +++ b/src/main/org/insa/graphics/MainWindow.java @@ -157,7 +157,7 @@ public class MainWindow extends JFrame { this.currentPalette = this.basicPalette; wccPanel = new AlgorithmPanel(this, WeaklyConnectedComponentsAlgorithm.class, - "Weakly-Connected Components", new String[]{}, false, false); + "Weakly-Connected Components", new String[] {}, false, false); wccPanel.addStartActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -202,7 +202,7 @@ public class MainWindow extends JFrame { }); spPanel = new AlgorithmPanel(this, ShortestPathAlgorithm.class, "Shortest-Path", - new String[]{ "Origin", "Destination" }, true, true); + new String[] { "Origin", "Destination" }, true, true); spPanel.addStartActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -255,12 +255,12 @@ public class MainWindow extends JFrame { }); cpPanel = new AlgorithmPanel( - this, CarPoolingAlgorithm.class, "Car-Pooling", new String[]{ "Origin Car", + this, CarPoolingAlgorithm.class, "Car-Pooling", new String[] { "Origin Car", "Origin Pedestrian", "Destination Car", "Destination Pedestrian" }, true, true); psPanel = new AlgorithmPanel(this, PackageSwitchAlgorithm.class, "Car-Pooling", - new String[]{ "Oribin A", "Origin B", "Destination A", "Destination B" }, true, + new String[] { "Oribin A", "Origin B", "Destination A", "Destination B" }, true, true); // add algorithm panels @@ -592,6 +592,10 @@ public class MainWindow extends JFrame { return; } + // In case of.... + progressBar.setVisible(false); + progressBar = null; + String info = graph.getMapId(); if (graph.getMapName() != null && !graph.getMapName().isEmpty()) { // The \u200e character is the left-to-right mark, we need to avoid issue with