Skip to content

Commit

Permalink
MainWindow: change duke to earl
Browse files Browse the repository at this point in the history
  • Loading branch information
yisiox committed Feb 15, 2024
1 parent 7f3d048 commit 14c68c4
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/main/java/earl/gui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class MainWindow extends AnchorPane {

private Image userImage = new Image(
this.getClass().getResourceAsStream("/images/DaUser.png"));
private Image dukeImage = new Image(
private Image earlImage = new Image(
this.getClass().getResourceAsStream("/images/DaDuke.png"));

@FXML
Expand All @@ -42,7 +42,7 @@ public void setEarl(Earl e) {
/** Displays the initial message on startup. */
public void showGreeting() {
dialogContainer.getChildren().addAll(
DialogBox.getEarlDialog(earl.getResponse(), dukeImage));
DialogBox.getEarlDialog(earl.getResponse(), earlImage));
}

/**
Expand All @@ -61,16 +61,21 @@ private void handleUserInput() {
displayDialog(input, response);
}

/** Signals the Earl object to terminate execution. */
public void handleExit() {
String input = "bye";
String response = earl.getResponse(input);
displayDialog(input, response);
earl.getResponse("bye");
}

/**
* Displays the dialog boxes on the GUI.
*
* @param input text to display on the user's side
* @param response text to display on the application's side
*/
private void displayDialog(String input, String response) {
dialogContainer.getChildren().addAll(
DialogBox.getUserDialog(input + " ".repeat(4), userImage),
DialogBox.getEarlDialog(response, dukeImage));
DialogBox.getEarlDialog(response, earlImage));
userInput.clear();
}
}

0 comments on commit 14c68c4

Please sign in to comment.