diff --git a/build.gradle b/build.gradle index f6ba67c23e..397692abef 100644 --- a/build.gradle +++ b/build.gradle @@ -29,6 +29,7 @@ dependencies { } test { + systemProperty "file.encoding", "utf-8" useJUnitPlatform() testLogging { @@ -43,9 +44,16 @@ test { } application { + applicationDefaultJvmArgs = ["-Dfile.encoding=utf-8"] mainClassName = "duke.Duke" } +compileJava.options.encoding = 'UTF-8' + +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' +} + shadowJar { archiveBaseName = "duke" archiveClassifier = null @@ -56,5 +64,6 @@ checkstyle { } run{ + systemProperty "file.encoding", "utf-8" standardInput = System.in } diff --git a/data/save.txt b/data/save.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/main/java/duke/Duke.java b/src/main/java/duke/Duke.java index d14945b520..254ac1033e 100644 --- a/src/main/java/duke/Duke.java +++ b/src/main/java/duke/Duke.java @@ -28,7 +28,8 @@ public static void main(String[] args) { * Starts the chatbot. */ public static void initialize() { - Storage storage = new Storage("./data"); + String home = System.getProperty("user.dir"); + Storage storage = new Storage( home + "/data"); if (Storage.hasLoadingError) { return; } diff --git a/src/main/java/duke/DukeException.java b/src/main/java/duke/DukeException.java index a15cbc8b46..e2f2dc7e2d 100644 --- a/src/main/java/duke/DukeException.java +++ b/src/main/java/duke/DukeException.java @@ -13,6 +13,6 @@ public DukeException(String message) { */ public static void tryAgain() { System.out.println(); - System.out.println("Please try again: "); + System.out.println("Please try again."); } } diff --git a/src/main/java/duke/Main.java b/src/main/java/duke/Main.java index d5a703bfbd..2f986acdc1 100644 --- a/src/main/java/duke/Main.java +++ b/src/main/java/duke/Main.java @@ -5,6 +5,7 @@ import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; +import javafx.scene.image.Image; import javafx.scene.layout.AnchorPane; import javafx.stage.Stage; @@ -25,6 +26,9 @@ public void start(Stage stage) { fxmlLoader.getController().setDuke(duke); fxmlLoader.getController().showGreeting(); stage.show(); + stage.setTitle("Duke"); + stage.getIcons().add(new Image(Main.class.getResourceAsStream("/images/icon.png"))); + // Shooting Stars icon by Icons8 from https://icons8.com/icon/81220/shooting-stars } catch (IOException e) { e.printStackTrace(); } diff --git a/src/main/java/duke/MainWindow.java b/src/main/java/duke/MainWindow.java index c2999a37e1..a322f6e18c 100644 --- a/src/main/java/duke/MainWindow.java +++ b/src/main/java/duke/MainWindow.java @@ -27,7 +27,10 @@ public class MainWindow extends AnchorPane { private Duke duke; private Image userImage = new Image(this.getClass().getResourceAsStream("/images/User.png")); + // Standing Man icon by Icons8 from https://icons8.com/icon/8NzonSPORfzB/man-in-a-tuxedo + private Image dukeImage = new Image(this.getClass().getResourceAsStream("/images/Duke.png")); + // Man In A Tuxedo icon by Icons8 from https://icons8.com/icon/21832/standing-man @FXML public void initialize() { diff --git a/src/main/java/duke/Parser.java b/src/main/java/duke/Parser.java index 589433b401..7f36a2c0fd 100644 --- a/src/main/java/duke/Parser.java +++ b/src/main/java/duke/Parser.java @@ -118,14 +118,14 @@ public static Task parseNewTaskCommand(String input, Task.TaskType tasktype) thr return parseTaskWithTime(input, tasktype, "/by"); } catch (IndexOutOfBoundsException e) { throw new DukeException("\u2639 Oops wrong format, use add deadline format: " - + "deadline [task] /by [time (can be 'YYYY-MM-DD HHMM')] !"); + + "deadline [task] /by [time (can be 'YYYY-MM-DD HHMM')]"); } } else if (tasktype == Task.TaskType.EVENT) { try { return parseTaskWithTime(input, tasktype, "/at"); } catch (IndexOutOfBoundsException e) { throw new DukeException("\u2639 Oops wrong format, use add event format: " - + "event [task] /at [time] !"); + + "event [task] /at [time]"); } } else { return new Task("this task should not be created"); diff --git a/src/main/java/duke/Ui.java b/src/main/java/duke/Ui.java index f4e84c6d26..8434aef306 100644 --- a/src/main/java/duke/Ui.java +++ b/src/main/java/duke/Ui.java @@ -63,15 +63,12 @@ public void run() { * Draws the top border of the chatbot's response. */ public static void drawTopBorder() { - System.out.println("___________________________________"); } /** * Draws the bottom border of the chatbot's response. */ public static void drawBottomBorder() { - System.out.println("___________________________________"); - } /** @@ -125,25 +122,12 @@ public static void greet() { public static String getGreeting() { setLogo(); - String greeting = " Hey! I'm Duke the chatbot!"; - String doForYou = " What can I do for you?"; + String greeting = "Hey! I'm Duke the chatbot!"; + String doForYou = "What can I do for you?"; return logo + "\n" + greeting + "\n" + doForYou; } public static void setLogo() { - logo = "\n" + - " ___ ___ \n" + - " ( ) ( ) \n" + - " .-.| | ___ ___ | | ___ .--. \n" + - " / \\ | ( )( ) | | ( ) / \\ \n" + - "| .-. | | | | | | | ' / | .-. ; \n" + - "| | | | | | | | | |,' / | | | | \n" + - "| | | | | | | | | . '. | |/ | \n" + - "| | | | | | | | | | `. \\ | ' _.' \n" + - "| ' | | | | ; ' | | \\ \\ | .'.-. \n" + - "' `-' / ' `-' / | | \\ . ' `-' / \n" + - " `.__,' '.__.' (___ ) (___) `.__.' \n" + - " \n" + - " \n"; + logo = "DUKE!"; } } diff --git a/src/main/java/duke/data/save.txt b/src/main/java/duke/data/save.txt index 3d60a97ac4..ae760eabb2 100644 --- a/src/main/java/duke/data/save.txt +++ b/src/main/java/duke/data/save.txt @@ -1,7 +1,7 @@ -6 +5 todo assignment -todo resume todo project event meeting /at 1pm -todo settle problem deadline send email /by 10 Oct 2020, 09:00 PM +todo readings +0 1 3 4 diff --git a/src/main/java/duke/task/Task.java b/src/main/java/duke/task/Task.java index 199c26c37e..ea26dda856 100644 --- a/src/main/java/duke/task/Task.java +++ b/src/main/java/duke/task/Task.java @@ -50,7 +50,7 @@ public String getDescription() { public String getStatusIcon() { return (this.status == TaskStatus.DONE // return tick or X symbols - ? "\u2713" + ? "\u2714" : "\u2718"); } diff --git a/src/main/resources/images/Duke.png b/src/main/resources/images/Duke.png index d893658717..4a0db32372 100644 Binary files a/src/main/resources/images/Duke.png and b/src/main/resources/images/Duke.png differ diff --git a/src/main/resources/images/User.png b/src/main/resources/images/User.png index 3c82f45461..8ba336bb5d 100644 Binary files a/src/main/resources/images/User.png and b/src/main/resources/images/User.png differ diff --git a/src/main/resources/images/icon.png b/src/main/resources/images/icon.png new file mode 100644 index 0000000000..88abb88dd1 Binary files /dev/null and b/src/main/resources/images/icon.png differ diff --git a/src/main/resources/view/DialogBox.fxml b/src/main/resources/view/DialogBox.fxml index eb919c22dd..790cd3d969 100644 --- a/src/main/resources/view/DialogBox.fxml +++ b/src/main/resources/view/DialogBox.fxml @@ -5,12 +5,12 @@ - + - - \ No newline at end of file + diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml index c7fc4b0f98..232a767ed9 100644 --- a/src/main/resources/view/MainWindow.fxml +++ b/src/main/resources/view/MainWindow.fxml @@ -3,17 +3,32 @@ + + - + - - - \ No newline at end of file +