Browse Source

Fix issue with ProgressBar for loading graphs.

Holt59 6 years ago
parent
commit
ec9cd9c601

+ 1
- 7
src/main/org/insa/graphics/GraphReaderProgressBar.java View File

@@ -1,7 +1,6 @@
1 1
 package org.insa.graphics;
2 2
 
3 3
 import java.awt.Component;
4
-import java.awt.Dimension;
5 4
 
6 5
 import javax.swing.Box;
7 6
 import javax.swing.BoxLayout;
@@ -38,7 +37,7 @@ public class GraphReaderProgressBar extends JDialog implements GraphReaderObserv
38 37
     private final JProgressBar[] progressBars = new JProgressBar[3];
39 38
 
40 39
     // Current element read, and modulo.
41
-    private int[] counters = new int[]{ 0, 0, 0 };
40
+    private int[] counters = new int[] { 0, 0, 0 };
42 41
     private int[] modulos = new int[3];
43 42
 
44 43
     public GraphReaderProgressBar(JFrame owner) {
@@ -63,13 +62,8 @@ public class GraphReaderProgressBar extends JDialog implements GraphReaderObserv
63 62
         }
64 63
 
65 64
         pane.add(Box.createVerticalGlue());
66
-
67
-        pane.setPreferredSize(new Dimension(300, 120));
68
-
69 65
         setContentPane(pane);
70
-
71 66
         pack();
72
-
73 67
     }
74 68
 
75 69
     @Override

+ 8
- 4
src/main/org/insa/graphics/MainWindow.java View File

@@ -157,7 +157,7 @@ public class MainWindow extends JFrame {
157 157
         this.currentPalette = this.basicPalette;
158 158
 
159 159
         wccPanel = new AlgorithmPanel(this, WeaklyConnectedComponentsAlgorithm.class,
160
-                "Weakly-Connected Components", new String[]{}, false, false);
160
+                "Weakly-Connected Components", new String[] {}, false, false);
161 161
         wccPanel.addStartActionListener(new ActionListener() {
162 162
             @Override
163 163
             public void actionPerformed(ActionEvent e) {
@@ -202,7 +202,7 @@ public class MainWindow extends JFrame {
202 202
         });
203 203
 
204 204
         spPanel = new AlgorithmPanel(this, ShortestPathAlgorithm.class, "Shortest-Path",
205
-                new String[]{ "Origin", "Destination" }, true, true);
205
+                new String[] { "Origin", "Destination" }, true, true);
206 206
         spPanel.addStartActionListener(new ActionListener() {
207 207
             @Override
208 208
             public void actionPerformed(ActionEvent e) {
@@ -255,12 +255,12 @@ public class MainWindow extends JFrame {
255 255
         });
256 256
 
257 257
         cpPanel = new AlgorithmPanel(
258
-                this, CarPoolingAlgorithm.class, "Car-Pooling", new String[]{ "Origin Car",
258
+                this, CarPoolingAlgorithm.class, "Car-Pooling", new String[] { "Origin Car",
259 259
                         "Origin Pedestrian", "Destination Car", "Destination Pedestrian" },
260 260
                 true, true);
261 261
 
262 262
         psPanel = new AlgorithmPanel(this, PackageSwitchAlgorithm.class, "Car-Pooling",
263
-                new String[]{ "Oribin A", "Origin B", "Destination A", "Destination B" }, true,
263
+                new String[] { "Oribin A", "Origin B", "Destination A", "Destination B" }, true,
264 264
                 true);
265 265
 
266 266
         // add algorithm panels
@@ -592,6 +592,10 @@ public class MainWindow extends JFrame {
592 592
                     return;
593 593
                 }
594 594
 
595
+                // In case of....
596
+                progressBar.setVisible(false);
597
+                progressBar = null;
598
+
595 599
                 String info = graph.getMapId();
596 600
                 if (graph.getMapName() != null && !graph.getMapName().isEmpty()) {
597 601
                     // The \u200e character is the left-to-right mark, we need to avoid issue with

Loading…
Cancel
Save