From ceb7198c47e59a3256af7a957c20a55a3329a7cb Mon Sep 17 00:00:00 2001 From: LimZiJia Date: Mon, 26 Feb 2024 05:39:47 +0800 Subject: [PATCH] Improve JavaFX --- data/duke.txt | 8 ++--- src/main/duke/ui/DialogBox.java | 14 +++++++-- src/main/resources/view/DialogBox.fxml | 41 +++++++++++--------------- 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/data/duke.txt b/data/duke.txt index ab2ec37b2a..0287644654 100644 --- a/data/duke.txt +++ b/data/duke.txt @@ -1,5 +1,3 @@ -T,0,1 -T,0,2 -T,0,3 -T,0,4 -T,0,5 +T,0,2106_lab_2 +E,0,mid_terms,2024-03-01,2024-03-14 +D,0,2102_assignment_1,2024-03-07 diff --git a/src/main/duke/ui/DialogBox.java b/src/main/duke/ui/DialogBox.java index 5eb43e78e7..58461de7ba 100644 --- a/src/main/duke/ui/DialogBox.java +++ b/src/main/duke/ui/DialogBox.java @@ -18,6 +18,7 @@ import javafx.scene.layout.CornerRadii; import javafx.scene.layout.HBox; import javafx.scene.paint.Color; +import javafx.scene.shape.Circle; /** * An example of a custom control using FXML. @@ -41,9 +42,16 @@ private DialogBox(String text, Image img, Color c) { e.printStackTrace(); } + Circle clip = new Circle(); + clip.setCenterX(90); + clip.setCenterY(90); + clip.setRadius(82); dialog.setText(text); displayPicture.setImage(img); - setBackground(new Background(new BackgroundFill(c, CornerRadii.EMPTY, Insets.EMPTY))); + displayPicture.setClip(clip); + setBackground(new Background(new BackgroundFill(c, + new CornerRadii(30), + new Insets(5, 5, 10, 10)))); } /** @@ -57,11 +65,11 @@ private void flip() { } public static DialogBox getUserDialog(String text, Image img) { - return new DialogBox(text, img, Color.AQUA); + return new DialogBox(text, img, Color.LIGHTSTEELBLUE); } public static DialogBox getDukeDialog(String text, Image img) { - var db = new DialogBox(text, img, Color.AQUAMARINE); + var db = new DialogBox(text, img, Color.LIGHTGRAY); db.flip(); return db; } diff --git a/src/main/resources/view/DialogBox.fxml b/src/main/resources/view/DialogBox.fxml index d06e206165..dd7fad9025 100644 --- a/src/main/resources/view/DialogBox.fxml +++ b/src/main/resources/view/DialogBox.fxml @@ -2,35 +2,30 @@ - - + - - - - - - - - - - - - - - + + + + + + + + + +