diff --git a/src/main/java/duke/DialogBox.java b/src/main/java/duke/DialogBox.java index 71d99bea4d..3590a89014 100644 --- a/src/main/java/duke/DialogBox.java +++ b/src/main/java/duke/DialogBox.java @@ -9,7 +9,7 @@ import javafx.scene.layout.HBox; /** - * A class that handles the dialog box for the dialog. + * Represents class that handles the dialog box for the dialog. */ public class DialogBox extends HBox { diff --git a/src/main/java/duke/Duke.java b/src/main/java/duke/Duke.java index de8b78acb3..b170e6ac06 100644 --- a/src/main/java/duke/Duke.java +++ b/src/main/java/duke/Duke.java @@ -17,7 +17,7 @@ import javafx.stage.Stage; /** - * Represent the Duke Bot. + * Represents the Duke Bot. * Entry point to the programme. */ public class Duke extends Application { @@ -32,27 +32,24 @@ public class Duke extends Application { private Image duke = new Image(this.getClass().getResourceAsStream("/images/Ben.jpg")); /** - * Entry point to the program + * Starts to the program * * @param stage the stage to be displayed. */ + //@@author Jeffry Lum-reused + //Reused from https://se-education.org/guides/tutorials/javaFx.html + // with minor modifications @Override public void start(Stage stage) { - //@@author Jeffry Lum-reused - //Reused from https://se-education.org/guides/tutorials/javaFx.html - // with minor modifications scrollPane = new ScrollPane(); dialogContainer = new VBox(); scrollPane.setContent(dialogContainer); - userInput = new TextField(); sendButton = new Button("Send"); - AnchorPane mainLayout = new AnchorPane(); mainLayout.getChildren().addAll(scrollPane, userInput, sendButton); scene = new Scene(mainLayout); - scene.getRoot().setStyle("-fx-font-family: 'Courier New'"); stage.setScene(scene); stage.show(); @@ -62,24 +59,19 @@ public void start(Stage stage) { stage.setMinWidth(400.0); mainLayout.setPrefSize(400.0, 600.0); - scrollPane.setPrefSize(385, 535); scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS); - scrollPane.setVvalue(1.0); scrollPane.setFitToWidth(true); dialogContainer.setPrefHeight(Region.USE_COMPUTED_SIZE); userInput.setPrefWidth(325.0); - sendButton.setPrefWidth(55.0); AnchorPane.setTopAnchor(scrollPane, 1.0); - AnchorPane.setBottomAnchor(sendButton, 1.0); AnchorPane.setRightAnchor(sendButton, 1.0); - AnchorPane.setLeftAnchor(userInput , 1.0); AnchorPane.setBottomAnchor(userInput, 1.0); @@ -88,12 +80,12 @@ public void start(Stage stage) { } /** - * Add Duke setups after initial GUI setups. + * Adds a Duke object after initial GUI setups. */ + //@@author Jeffry Lum-reused + //Reused from https://se-education.org/guides/tutorials/javaFx.html + // with minor modifications public void addDuke() { - //@@author Jeffry Lum-reused - //Reused from https://se-education.org/guides/tutorials/javaFx.html - // with minor modifications Duke dukeBot = new Duke(); Parser parser = new Parser(); File myObj = new File(Storage.FILENAME); @@ -129,10 +121,10 @@ public void addDuke() { * @param parser The parser used for processing input. * @param data The data used for storage. */ + //@@author Jeffry Lum-reused + //Reused from https://se-education.org/guides/tutorials/javaFx.html + // with minor modifications private void handleUserInput(Duke dukeBot, Parser parser, Storage data) { - //@@author Jeffry Lum-reused - //Reused from https://se-education.org/guides/tutorials/javaFx.html - // with minor modifications if (userInput.getText().equals(QUIT_COMMAND)) { System.exit(0); } diff --git a/src/main/java/duke/Launcher.java b/src/main/java/duke/Launcher.java index 1a831001a8..1d3fecb103 100644 --- a/src/main/java/duke/Launcher.java +++ b/src/main/java/duke/Launcher.java @@ -3,11 +3,11 @@ import javafx.application.Application; /** - * A launcher class to workaround classpath issues. + * Represents a launcher class to workaround classpath issues. */ public class Launcher { /** - * Start of the programme. + * Launches the programme. * * @param args default. */ diff --git a/src/main/java/duke/List.java b/src/main/java/duke/List.java index 60ab7cdbfb..1915da869d 100644 --- a/src/main/java/duke/List.java +++ b/src/main/java/duke/List.java @@ -6,7 +6,7 @@ import java.util.ArrayList; /** - * Represents the Todo List for Duke. + * Represents the List of tasks for Duke. */ public class List { public static final String DISPLAY_LIST_COMMAND = "list"; @@ -38,7 +38,7 @@ public ArrayList getTodos() { } /** - * Adds Task to the List. + * Adds a Task to the List. * * @param input the command given. * @throws IOException If the file cannot be read/found. @@ -51,17 +51,16 @@ public String addTask(String input, Parser parser) throws IOException { } if (input.equals(HELP_COMMAND)) { return helpPage(); - } else { - try { - return parser.process(input, this); - } catch (DukeException e) { - return (e.getMessage()); - } + } + try { + return parser.process(input, this); + } catch (DukeException e) { + return (e.getMessage()); } } /** - * Display the current content of the list. + * Displays the current content of the list. * Ordered by creation time. * * @returns The list in String. diff --git a/src/main/java/duke/Parser.java b/src/main/java/duke/Parser.java index 460974a6a5..abadf6c0eb 100644 --- a/src/main/java/duke/Parser.java +++ b/src/main/java/duke/Parser.java @@ -7,7 +7,7 @@ */ public class Parser { /** - * Handles the input commands and execute the commands. + * Handles the input commands and calls the correct commands. * * @param list The current todolist. * @param input The command given by the user. @@ -37,7 +37,7 @@ public String process(String input, List list) throws DukeException { } /** - * Process todos commands. + * Processes todos commands. * * @param input The command given by the user. * @param list The current todolist. @@ -55,7 +55,7 @@ public String processTodo(String input, List list) throws DukeTodoException { } /** - * Process deadline commands. + * Processes deadline commands. * * @param input The command given by the user. * @param list The current todolist. @@ -77,7 +77,7 @@ public String processDeadline(String input, List list) throws DukeDeadlineExcept } /** - * Process event commands. + * Processes event commands. * * @param input The command given by the user. * @param list The current todolist. diff --git a/src/main/java/duke/Storage.java b/src/main/java/duke/Storage.java index 6357535681..5914404507 100644 --- a/src/main/java/duke/Storage.java +++ b/src/main/java/duke/Storage.java @@ -7,7 +7,7 @@ import java.util.Scanner; /** - * A representation of a class that handles the reading and writing of the data. + * Represents of a class that handles the reading and writing of the data. */ public class Storage { public static final String FILENAME = "filename.txt"; @@ -25,7 +25,7 @@ public Storage(File file) { /** * Reads the data from the File. - * Add the entries to the List according to the order in data. + * Adds the entries to the List according to the order in data. * * @return A newly created List of Tasks. * @throws IOException If the file cannot be read/found. diff --git a/src/main/java/duke/Task.java b/src/main/java/duke/Task.java index ba2a83277d..146e5acad5 100644 --- a/src/main/java/duke/Task.java +++ b/src/main/java/duke/Task.java @@ -1,7 +1,7 @@ package duke; /** - * A representation of a Task Class. + * Represents a Task Class. * Handles operations that are common for all Tasks. */ public class Task { @@ -21,8 +21,7 @@ public Task(String name) { } /** - * Overloaded constructor for Task Class. - * Used when loading data. + * Overloaded constructor for Task Class when loading data. * * @param name Name of the Task. * @param done Done status of the Task. @@ -49,8 +48,7 @@ public void markAsDone() { } /** - * Handles the creation of new Tasks. - * Used when loading the data from file. + * Handles the creation of new Tasks when loading the data from file. * * @param input The line from data. * @return A Task based on the input.