Browse Source

Fix issue with drawing not being drawn when opening from central button.

Mikael Capelle 3 years ago
parent
commit
990b74bf1a
1 changed files with 8 additions and 4 deletions
  1. 8
    4
      src/main/org/insa/graphics/MainWindow.java

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

@@ -156,7 +156,7 @@ public class MainWindow extends JFrame {
156 156
         this.currentPalette = this.basicPalette;
157 157
 
158 158
         wccPanel = new AlgorithmPanel(this, WeaklyConnectedComponentsAlgorithm.class,
159
-                "Weakly-Connected Components", new String[] {}, false, false);
159
+                "Weakly-Connected Components", new String[]{}, false, false);
160 160
         wccPanel.addStartActionListener(new ActionListener() {
161 161
             @Override
162 162
             public void actionPerformed(ActionEvent e) {
@@ -201,7 +201,7 @@ public class MainWindow extends JFrame {
201 201
         });
202 202
 
203 203
         spPanel = new AlgorithmPanel(this, ShortestPathAlgorithm.class, "Shortest-Path",
204
-                new String[] { "Origin", "Destination" }, true, true);
204
+                new String[]{ "Origin", "Destination" }, true, true);
205 205
         spPanel.addStartActionListener(new ActionListener() {
206 206
             @Override
207 207
             public void actionPerformed(ActionEvent e) {
@@ -254,12 +254,12 @@ public class MainWindow extends JFrame {
254 254
         });
255 255
 
256 256
         cpPanel = new AlgorithmPanel(
257
-                this, CarPoolingAlgorithm.class, "Car-Pooling", new String[] { "Origin Car",
257
+                this, CarPoolingAlgorithm.class, "Car-Pooling", new String[]{ "Origin Car",
258 258
                         "Origin Pedestrian", "Destination Car", "Destination Pedestrian" },
259 259
                 true, true);
260 260
 
261 261
         psPanel = new AlgorithmPanel(this, PackageSwitchAlgorithm.class, "Car-Pooling",
262
-                new String[] { "Oribin A", "Origin B", "Destination A", "Destination B" }, true,
262
+                new String[]{ "Oribin A", "Origin B", "Destination A", "Destination B" }, true,
263 263
                 true);
264 264
 
265 265
         // add algorithm panels
@@ -465,6 +465,9 @@ public class MainWindow extends JFrame {
465 465
         if (!(mainPanel.getLeftComponent() instanceof Drawing)) {
466 466
             mainPanel.setLeftComponent((Component) this.drawing);
467 467
             mainPanel.setDividerLocation(oldLocation);
468
+            // Need to re-validate or the drawing will not have the
469
+            // correct size prior to drawing, which can cause issue.
470
+            this.revalidate();
468 471
         }
469 472
 
470 473
         boolean isNewGraph = newClass == null;
@@ -510,6 +513,7 @@ public class MainWindow extends JFrame {
510 513
                 notifyDrawingLoaded(basicDrawing, mapViewDrawing);
511 514
                 drawing.clear();
512 515
                 isNewGraph = true;
516
+                mainPanel.revalidate();
513 517
             }
514 518
             if (isNewGraph) {
515 519
                 drawing.clear();

Loading…
Cancel
Save