Skip to content

Commit

Permalink
Update style
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoukerrr committed Sep 17, 2021
1 parent 38a2512 commit 367b15d
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 43 deletions.
2 changes: 1 addition & 1 deletion src/main/java/duke/DialogBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
32 changes: 12 additions & 20 deletions src/main/java/duke/Duke.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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();
Expand All @@ -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);

Expand All @@ -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);
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/duke/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
17 changes: 8 additions & 9 deletions src/main/java/duke/List.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -38,7 +38,7 @@ public ArrayList<Task> 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.
Expand All @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/duke/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/duke/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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.
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/duke/Task.java
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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.
Expand All @@ -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.
Expand Down

0 comments on commit 367b15d

Please sign in to comment.