Commits

beholdmyglory  committed 2f55143

If running, stop the simulation before saving/opening

  • Participants
  • Parent commits d9e84f9

Comments (0)

Files changed (1)

File src/se/kth/csc/inda11/remains/gui/MainWindow.java

                     File f = fileChooser.getSelectedFile();
                     if (f.exists()) {
                         try {
+                            if (MainWindow.this.timer.isRunning()) {
+                                MainWindow.this.timer.stop();
+                            }
+                            
                             List<Map.Entry<Point, Simulator.Cell>> cellList = FileParser.parseFile(f);
                             MainWindow.this.simulator.reset();
                             for (Map.Entry<Point, Simulator.Cell> entry : cellList) {
                                     "Overwrite File",
                                     JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                         try {
+                            if (MainWindow.this.timer.isRunning()) {
+                                MainWindow.this.timer.stop();
+                            }
+                            
                             FileParser.saveFile(f, MainWindow.this.simulator);
                         } catch (IOException ex) {
                             JOptionPane.showMessageDialog(MainWindow.this,