Skip to content

Commit

Permalink
Added GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
IamZhenHong committed Feb 22, 2024
1 parent ae1320a commit 8fc3eeb
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "interactive"
}
20 changes: 17 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,21 @@ repositories {
dependencies {
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.10.0'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.10.0'

String javaFxVersion = '17.0.7'


implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'linux'
}

test {
Expand All @@ -31,9 +45,9 @@ test {


}

mainClassName = "duke.Launcher"
application {
mainClass.set("seedu.duke.Duke")
mainClass.set("Launcher")

}

Expand Down
17 changes: 15 additions & 2 deletions src/main/java/duke/Duke.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,37 @@
import duke.Command.Command;

import duke.Task.Task;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.stage.Stage;


/**
* The Duke class represents a task management application.
* It allows users to add, delete, and mark tasks as done.
*/
public class Duke {
public class Duke extends Application{
private TaskList taskList;

/**
* Constructs a Duke object.
* Loads tasks from file and initializes the task list.
*/
Duke() {
public Duke() {
ArrayList<Task> tasks = Storage.loadTasksFromFile();
taskList = new TaskList(tasks);
}

@Override
public void start(Stage stage) {
Label helloWorldLabel = new Label("Hello World!");
Scene scene = new Scene(helloWorldLabel);
stage.setScene(scene);
stage.show();

}

/**
* Runs the Duke application.
* Prompts the user for commands and executes them until the user enters "bye".
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/duke/Launcher.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package duke;

import javafx.application.Application;
import javafx.scene.Scene;
import duke.Duke;
/**
* A launcher class to workaround classpath issues.
*/
public class Launcher {
public static void main(String[] args) {

Application.launch(Duke.class, args);

}
}

0 comments on commit 8fc3eeb

Please sign in to comment.