Skip to content

Commit

Permalink
Update GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
jzwoo authored and jzwoo committed Sep 16, 2020
1 parent a1865eb commit acfeede
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/main/java/DialogBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.shape.Circle;

public class DialogBox extends HBox {

Expand All @@ -19,7 +20,7 @@ public class DialogBox extends HBox {
@FXML
private ImageView displayPicture;

private DialogBox(String text, Image img) {
private DialogBox(String text, Image img, boolean isUser) {
try {
FXMLLoader fxmlLoader = new FXMLLoader(MainWindow.class.getResource("/view/DialogBox.fxml"));
fxmlLoader.setController(this);
Expand All @@ -31,8 +32,18 @@ private DialogBox(String text, Image img) {

dialog.setText(text);
displayPicture.setImage(img);

dialog.setText(text);
displayPicture.setImage(img);

displayPicture.setClip(new Circle(50, 50, 50));

if (isUser) {
this.dialog.setStyle("-fx-background-color: #d4c69e;");
}
}


/**
* Flips the dialog box such that the ImageView is on the left and text on the right.
*/
Expand All @@ -44,11 +55,11 @@ private void flip() {
}

public static DialogBox getUserDialog(String text, Image img) {
return new DialogBox(text, img);
return new DialogBox(text, img, true);
}

public static DialogBox getDukeDialog(String text, Image img) {
var db = new DialogBox(text, img);
var db = new DialogBox(text, img, false);
db.flip();
return db;
}
Expand Down

0 comments on commit acfeede

Please sign in to comment.