Browse Source

Fix issue with SolutionPanel and Java 9.

Mikael Capelle 3 years ago
parent
commit
455090e10a
1 changed files with 12 additions and 14 deletions
  1. 12
    14
      src/main/org/insa/graphics/SolutionPanel.java

+ 12
- 14
src/main/org/insa/graphics/SolutionPanel.java View File

@@ -122,7 +122,6 @@ public class SolutionPanel extends JPanel implements DrawingChangeListener, Grap
122 122
 
123 123
         /*
124 124
          * (non-Javadoc)
125
-         * 
126 125
          * @see java.lang.Object#toString()
127 126
          */
128 127
         public String toString() {
@@ -192,25 +191,24 @@ public class SolutionPanel extends JPanel implements DrawingChangeListener, Grap
192 191
         solutionSelect.addActionListener(new ActionListener() {
193 192
             public void actionPerformed(ActionEvent e) {
194 193
 
195
-                SolutionBundle bundle = (SolutionBundle) solutionSelect.getSelectedItem();
196
-
197
-                // Handle case when the JComboBox is empty.
198
-                if (bundle == null) {
199
-                    return;
200
-                }
201
-
202 194
                 if (currentBundle != null) {
203 195
                     for (PathOverlay overlay: currentBundle.getOverlays()) {
204 196
                         overlay.setVisible(false);
205 197
                     }
206 198
                 }
207 199
 
208
-                updateInformationLabel(bundle);
209
-                buttonPanel.setVisible(bundle.getSolution().isFeasible() && bundle.hasOverlays());
210
-                clearButton.setText(bundle.getSolution().isFeasible() ? "Hide" : "Show");
200
+                SolutionBundle bundle = (SolutionBundle) solutionSelect.getSelectedItem();
211 201
 
212
-                for (PathOverlay overlay: bundle.getOverlays()) {
213
-                    overlay.setVisible(true);
202
+                if (bundle != null) {
203
+
204
+                    updateInformationLabel(bundle);
205
+                    buttonPanel
206
+                            .setVisible(bundle.getSolution().isFeasible() && bundle.hasOverlays());
207
+                    clearButton.setText(bundle.getSolution().isFeasible() ? "Hide" : "Show");
208
+
209
+                    for (PathOverlay overlay: bundle.getOverlays()) {
210
+                        overlay.setVisible(true);
211
+                    }
214 212
                 }
215 213
 
216 214
                 currentBundle = bundle;
@@ -249,7 +247,7 @@ public class SolutionPanel extends JPanel implements DrawingChangeListener, Grap
249 247
 
250 248
         if (enabled) {
251 249
             // Trigger event
252
-            solutionSelect.actionPerformed(null);
250
+            solutionSelect.setSelectedItem(currentBundle);
253 251
         }
254 252
         else {
255 253
             SolutionBundle bundle = (SolutionBundle) this.solutionSelect.getSelectedItem();

Loading…
Cancel
Save