Skip to content

Commit

Permalink
Merge pull request #10 from rgonslayer/Level-10
Browse files Browse the repository at this point in the history
Update Introduction and Exit Condition
  • Loading branch information
rgonslayer authored Sep 19, 2022
2 parents 81f7c97 + 3843e60 commit f96b6e3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion data/taskList.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
T | 0 | read book
D | 0 | return book | 2022-09-20
T | 0 | gym
T | 0 | finish coding
T | 0 | code
5 changes: 5 additions & 0 deletions src/main/java/jarvis/MainWindow.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package jarvis;

import jarvis.exception.JarvisException;
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ScrollPane;
Expand Down Expand Up @@ -29,6 +30,7 @@ public class MainWindow extends AnchorPane {
@FXML
public void initialize() {
scrollPane.vvalueProperty().bind(dialogContainer.heightProperty());
dialogContainer.getChildren().add(DialogBox.getDukeDialog(Parser.introduction(), jarvisImage));
}

public void setJarvis(Jarvis j) {
Expand All @@ -47,6 +49,9 @@ private void handleUserInput() throws JarvisException {
DialogBox.getUserDialog(input, userImage),
DialogBox.getDukeDialog(response, jarvisImage)
);
if (response.equals("Goodbye, have a good day.")) {
Platform.exit();
}
userInput.clear();
}
}
6 changes: 4 additions & 2 deletions src/main/java/jarvis/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import jarvis.task.*;
import jarvis.exception.JarvisException;

import java.util.Scanner;

public class Parser {

private static String introduction = "Hello. I am Jarvis \n"
Expand Down Expand Up @@ -118,5 +116,9 @@ public String readCommand(String input) throws JarvisException {
return "I'm sorry, but I don't know what that means";
}
}

public static String introduction() {
return introduction;
}
}

0 comments on commit f96b6e3

Please sign in to comment.