Skip to content

Commit

Permalink
Add ability to save task even if user clicks on close window button
Browse files Browse the repository at this point in the history
  • Loading branch information
Gordon25 committed Sep 28, 2021
1 parent 2dff293 commit ad263d3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/duke/gui/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public void start(Stage stage) {
stage.setScene(scene);
fxmlLoader.<MainWindow>getController().setDuke(duke);
stage.show();
stage.setOnCloseRequest(event -> {
String terminate = "bye";
duke.getResponse(terminate);
});
} catch (IOException e) {
e.printStackTrace();
}
Expand Down

0 comments on commit ad263d3

Please sign in to comment.