Skip to content

Commit 4b9470d

Browse files
committed
[Doc] - Improve javadocs and give credit for reused/referred code
1 parent d74a636 commit 4b9470d

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

src/main/java/duke/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class Main extends Application {
2121

2222
@Override
2323
public void start(Stage stage) {
24+
// Solution below adapted from JavaFx Tutorial by Jeffry Lum.
2425
FXMLLoader fxmlLoader = new FXMLLoader(Main.class.getResource("/view/Gui.fxml"));
2526
AnchorPane ap;
2627
try {
@@ -48,6 +49,5 @@ public void handle(WindowEvent event) {
4849
new Thread(() -> {
4950
duke.run();
5051
}).start();
51-
5252
}
5353
}

src/main/java/duke/commands/Command.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public interface Command {
1515
* @param arg Arguments for the command (may be empty).
1616
* @param tasks List of Tasks.
1717
* @param ui User interface for Duke.
18+
* @param storage Storage for Duke.
1819
* @throws DukeException If inputs are invalid.
1920
*/
2021
void execute(String arg, TaskList tasks, Ui ui, Storage storage) throws DukeException;

src/main/java/duke/ui/DialogBox.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717

1818
import duke.exceptions.DukeException;
1919

20-
2120
/**
22-
* This control represents a dialog box consisting of an ImageView to represent the speaker's face and a label
23-
* containing text from the speaker.
21+
* This control represents a dialog box consisting of an ImageView to represent
22+
* the speaker's face and a label containing text from the speaker.
2423
*/
2524
public class DialogBox extends HBox {
25+
// @@author joel-lim-reused
26+
// Reused from JavaFx Tutorial by Jeffry Lum.
2627
@FXML
2728
private Label dialog;
2829
@FXML
@@ -43,7 +44,8 @@ private DialogBox(String text, Image img) throws DukeException {
4344
}
4445

4546
/**
46-
* Flips the dialog box such that the ImageView is on the left and text on the right.
47+
* Flips the dialog box such that the ImageView is on the left and text on the
48+
* right.
4749
*/
4850
private void flip() {
4951
ObservableList<Node> tmp = FXCollections.observableArrayList(this.getChildren());
@@ -52,13 +54,21 @@ private void flip() {
5254
setAlignment(Pos.TOP_LEFT);
5355
}
5456

57+
/**
58+
* Gets a DialogBox with the User's image.
59+
*/
5560
public static DialogBox getUserDialog(String text, Image img) throws DukeException {
5661
return new DialogBox(text, img);
5762
}
5863

64+
/**
65+
* Gets a flipped DialogBox with Duke's image.
66+
*/
5967
public static DialogBox getDukeDialog(String text, Image img) throws DukeException {
6068
var db = new DialogBox(text, img);
6169
db.flip();
6270
return db;
6371
}
72+
73+
// @@author
6474
}

src/main/java/duke/ui/Gui.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* Controller for the Main Window of the GUI for Duke.
1919
*/
2020
public class Gui extends AnchorPane implements Ui {
21+
// Solution below adapted from JavaFx Tutorial by Jeffry Lum.
2122
@FXML
2223
private ScrollPane scrollPane;
2324
@FXML

0 commit comments

Comments
 (0)