Fix exception when exiting showDialog

This commit was merged in pull request #22.
This commit is contained in:
antograb committed 2017-12-21 09:03:55 +01:00
1 parent 3cdf425435
commit 16df6a26c6
2 files changed
+4 -5

No files matched your search

+3 -3
View File
@@ -32,13 +32,13 @@ public class LoadMazeMenuItem extends JMenuItem
new FileNameExtensionFilter("Text files", "txt");
fileChooser.setFileFilter(filter);
String filename;
int returnVal = fileChooser.showOpenDialog(mazeApp);
if(returnVal == JFileChooser.APPROVE_OPTION) {
System.out.println("You chose to open this file: " +
fileChooser.getSelectedFile().getName());
}
String filename = fileChooser.getSelectedFile().getPath();
filename = fileChooser.getSelectedFile().getPath();
mazeApp.getMazeAppModel().setMaze(new Maze(filename));
}
}
}
+1 -2
View File
@@ -34,9 +34,8 @@ public class SaveMazeMenuItem extends JMenuItem
if(returnVal == JFileChooser.APPROVE_OPTION) {
System.out.println("You chose to save to this file: " +
fileChooser.getSelectedFile().getName());
}
String filename = fileChooser.getSelectedFile().getPath();
mazeApp.getMazeAppModel().saveToFile(filename);
}
}
}