Skip to content

Commit

Permalink
Merge pull request #13 from rgonslayer/A-Assertionss
Browse files Browse the repository at this point in the history
A-Assertions
  • Loading branch information
rgonslayer authored Sep 19, 2022
2 parents 17bf14e + f0b33ca commit 428ca03
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/jarvis/gui/DialogBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class DialogBox extends HBox {
private DialogBox(String text, Image img) {
try {
FXMLLoader fxmlLoader = new FXMLLoader(MainWindow.class.getResource("/view/DialogBox.fxml"));
assert fxmlLoader != null;
fxmlLoader.setController(this);
fxmlLoader.setRoot(this);
fxmlLoader.load();
Expand All @@ -50,10 +51,14 @@ private void flip() {
}

public static DialogBox getUserDialog(String text, Image img) {
assert text != null;
assert img != null;
return new DialogBox(text, img);
}

public static DialogBox getDukeDialog(String text, Image img) {
assert text != null;
assert img != null;
var db = new DialogBox(text, img);
db.flip();
return db;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/jarvis/gui/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class Main extends Application {
public void start(Stage stage) {
try {
FXMLLoader fxmlLoader = new FXMLLoader(Main.class.getResource("/view/MainWindow.fxml"));
assert fxmlLoader != null;
AnchorPane ap = fxmlLoader.load();
Scene scene = new Scene(ap);
stage.setScene(scene);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/jarvis/gui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public void setJarvis(Jarvis j) {
private void handleUserInput() throws JarvisException {
String input = userInput.getText();
String response = jarvis.getResponse(input);
assert userImage != null;
assert jarvisImage != null;
dialogContainer.getChildren().addAll(
DialogBox.getUserDialog(input, userImage),
DialogBox.getDukeDialog(response, jarvisImage)
Expand Down

0 comments on commit 428ca03

Please sign in to comment.