Skip to content

Commit 8ebd36c

Browse files
committed
Improve GUI for devin
1 parent 631bbf5 commit 8ebd36c

File tree

13 files changed

+51
-26
lines changed

13 files changed

+51
-26
lines changed

build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ dependencies {
3131
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'win'
3232
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'mac'
3333
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'linux'
34+
implementation group: 'org.openjfx', name: 'javafx-media', version: javaFxVersion, classifier: 'win'
35+
implementation group: 'org.openjfx', name: 'javafx-media', version: javaFxVersion, classifier: 'mac'
36+
implementation group: 'org.openjfx', name: 'javafx-media', version: javaFxVersion, classifier: 'linux'
3437
}
3538

3639
test {

src/main/java/devin/command/Command.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static String unmarkCommand(TaskList list, String[] texts, Storage storag
7878
if (list.getTasks().isEmpty()) {
7979
throw new DevinException("There is no task in the list!");
8080
} else if (texts.length != 2) {
81-
throw new DevinException("Please type a choose a task number");
81+
throw new DevinException("Please choose a task number");
8282
}
8383
int index = Integer.parseInt((texts[1])) - 1;
8484
if (index > list.getTasks().size() + 1 || index < 0) {
@@ -105,7 +105,7 @@ public static String deleteCommand(TaskList list, String[] texts, Storage storag
105105
if (list.getTasks().isEmpty()) {
106106
throw new DevinException("There is no task in the list!");
107107
} else if (texts.length != 2) {
108-
throw new DevinException("Please type a choose a task number");
108+
throw new DevinException("Please choose a task number");
109109
}
110110
int index = Integer.parseInt((texts[1])) - 1;
111111
if (index > list.getTasks().size() + 1 || index < 0) {

src/main/java/devin/dialogbox/DialogBox.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,12 @@ private void flip() {
4747
Collections.reverse(tmp);
4848
getChildren().setAll(tmp);
4949
setAlignment(Pos.TOP_LEFT);
50-
dialog.getStyleClass().add("reply-label");
5150
}
5251

5352
public static DialogBox getUserDialog(String text, Image img) {
54-
return new DialogBox(text, img);
53+
var db = new DialogBox(text, img);
54+
db.dialog.getStyleClass().add("user-label");
55+
return db;
5556
}
5657

5758
public static DialogBox getDevinDialog(String text, Image img) {

src/main/java/devin/main/MainWindow.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import javafx.scene.image.Image;
1616
import javafx.scene.layout.AnchorPane;
1717
import javafx.scene.layout.VBox;
18+
import javafx.scene.media.AudioClip;
1819
import javafx.util.Duration;
1920
/**
2021
* Controller for the main GUI.
@@ -31,9 +32,12 @@ public class MainWindow extends AnchorPane {
3132

3233
private Devin devin;
3334

34-
private Image userImage = new Image(this.getClass().getResourceAsStream("/images/DaUser.jpg"));
35-
private Image devinImage = new Image(this.getClass().getResourceAsStream("/images/DaDevin.jpg"));
35+
private Image userImage = new Image(this.getClass().getResourceAsStream("/images/DaUser.png"));
36+
private Image devinImage = new Image(this.getClass().getResourceAsStream("/images/DaDevin.png"));
3637

38+
private AudioClip sendSound = new AudioClip(this.getClass().getResource("/sounds/Send.wav").toString());
39+
private AudioClip responseSound = new AudioClip(this.getClass().getResource("/sounds/Notification.wav").toString());
40+
3741
/**
3842
* Methods to start when the app first initialise
3943
*/
@@ -43,6 +47,7 @@ public void initialize() {
4347
scrollPane.vvalueProperty().bind(dialogContainer.heightProperty());
4448
Devin.main(null);
4549
dialogContainer.getChildren().add(DialogBox.getDevinDialog(Ui.printGreet(), devinImage));
50+
responseSound.play(1.0);
4651
userInput.setPromptText("Type here...");
4752
} catch (DevinException | IOException e) {
4853
handleException(e.getMessage());
@@ -61,6 +66,7 @@ public void setDevin(Devin d) {
6166
@FXML
6267
private void handleUserInput() {
6368
try {
69+
sendSound.play(1.0);
6470
String input = userInput.getText();
6571
assert input != null: "There is no user input.";
6672
String response = devin.getResponse(input);
@@ -69,6 +75,7 @@ private void handleUserInput() {
6975
DialogBox.getUserDialog(input, userImage),
7076
DialogBox.getDevinDialog(response, devinImage)
7177
);
78+
responseSound.play(1.0);
7279
userInput.clear();
7380
//Solution inspired by ypuppy at https://github.com/nus-cs2103-AY2425S2/forum/issues/160
7481
if (input.contains("bye")) {

src/main/resources/css/dialog-box.css

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
.user-label {
2+
-fx-background-color: #A47EC6 !important;
3+
-fx-text-fill: #FFFFFF; /* White text for readability */
4+
-fx-background-radius: 1em; /* Uniform rounded corners */
5+
-fx-padding: 10px; /* Add some padding for better spacing */
6+
-fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.2), 5, 0.5, 2, 2); /* A bit less intense shadow */
7+
}
8+
19
.label {
2-
-fx-background-color: linear-gradient(to bottom right, #00ffbf, #00ddff);
3-
-fx-border-color: #d55e00 #009e73 #cc79a7 #0072b2;
4-
-fx-border-width: 2px;
5-
-fx-background-radius: 1em 1em 0 1em;
6-
-fx-border-radius: 1em 1em 0 1em;
10+
-fx-background-color: #6495ED;
11+
-fx-text-fill: #FFFFFF; /* White text for readability */
12+
-fx-background-radius: 1em; /* Uniform rounded corners */
13+
-fx-padding: 10px; /* Add some padding for better spacing */
14+
-fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.2), 5, 0.5, 2, 2); /* A bit less intense shadow */
715
}
816

917
.reply-label {
@@ -22,4 +30,3 @@
2230
/* Rotate image clockwise by degrees. */
2331
-fx-rotate: 0;
2432
}
25-

src/main/resources/css/main.css

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,36 @@
11
.root {
2-
main-color: rgb(237, 255, 242); /* Create a looked-up color called "main-color" within root. */
2+
main-color: #1E1E2E;
33
-fx-background-color: main-color;
4+
-fx-background-image: url("../images/background.jpg"); /* Set image */
5+
-fx-background-size: cover;
46
}
57

68
.text-field {
7-
-fx-background-color: #d9ffe2;
8-
-fx-font: 20px "Arial";
9+
-fx-background-color: rgba(44, 62, 80, 0.5); /* Translucent dark blue */
10+
-fx-text-fill: white;
11+
-fx-font: 18px "Arial";
12+
-fx-border-color: #5B92E5;
13+
-fx-border-radius: 5px;
14+
-fx-padding: 8px;
915
}
1016

1117
.button {
12-
-fx-background-color: mediumspringgreen;
18+
-fx-background-color: linear-gradient(to bottom, #5C6BC0, #3949AB); /* Indigo gradient */
19+
-fx-text-fill: white;
1320
-fx-font: italic bold 16px "Arial";
21+
-fx-border-radius: 8px;
22+
-fx-padding: 8px 16px;
23+
-fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.4), 5, 0, 0, 2);
1424
}
1525

1626
.button:hover {
17-
-fx-background-color:cyan;
18-
-fx-font-size: 18px;
27+
-fx-background-color: #3D5AFE; /* Brighter blue when hovered */
28+
-fx-font-size: 17px;
1929
}
2030

2131
.button:pressed {
22-
-fx-background-color:orange;
23-
-fx-font-size: 20px;
32+
-fx-background-color: #1E40AF; /* Darker blue when pressed */
33+
-fx-font-size: 17px;
2434
}
2535

2636
.scroll-pane,
@@ -29,19 +39,16 @@
2939
}
3040

3141
.scroll-bar {
32-
-fx-font-size: 10px; /* Change width of scroll bar. */
33-
-fx-background-color: main-color;
42+
-fx-background-color: transparent;
3443
}
3544

3645
.scroll-bar .thumb {
37-
-fx-background-color: #ff9cb4;
38-
-fx-background-radius: 1em;
46+
-fx-background-color: rgba(44, 62, 80, 0.7); /* Darker but semi-transparent */
47+
-fx-background-radius: 10px;
3948
}
4049

41-
/* Hides the increment and decrement buttons. */
4250
.scroll-bar .increment-button,
4351
.scroll-bar .decrement-button {
4452
-fx-pref-height: 0;
4553
-fx-opacity: 0;
4654
}
47-
-69.9 KB
Binary file not shown.
6.26 KB
Loading
-25.8 KB
Binary file not shown.
238 KB
Loading

0 commit comments

Comments
 (0)