Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Introduction and Exit Condition #10

Merged
merged 1 commit into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}