Skip to content

Commit

Permalink
Update GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
howenc committed Sep 19, 2023
1 parent 21d6ec0 commit a6f7220
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 15 deletions.
4 changes: 1 addition & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,11 @@ test {
}

application {
mainClass.set("duke.Duke")
mainClass.set("Launcher")
}

shadowJar {
archiveFileName = "duke.jar"
archiveBaseName = "duke"
archiveClassifier = null
dependsOn("distZip", "distTar")
}

Expand Down
30 changes: 30 additions & 0 deletions duke/data/duke.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
todo me
todo me
todo me
todo me
todo me
todo CS2103T A-JUnit
todo me
todo me
todo me
todo me
todo me
todo CS2103T A-JUnit
todo me
todo me
todo me
todo me
todo me
todo CS2103T A-JUnit
todo me
todo me
todo me
todo me
todo me
todo CS2103T A-JUnit
todo me
todo me
todo me
todo me
todo me
todo eyifgewishgsrfcvgye
1 change: 0 additions & 1 deletion src/data/duke.txt

This file was deleted.

1 change: 1 addition & 0 deletions src/main/java/gui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class MainWindow extends AnchorPane {
@FXML
public void initialize() {
scrollPane.vvalueProperty().bind(dialogContainer.heightProperty());
dialogContainer.prefWidthProperty().bind(scrollPane.widthProperty().multiply(0.99));
dialogContainer.getChildren().add(DialogBox.getDukeDialog(duke.greet(), luxionImage));
}

Expand Down
8 changes: 6 additions & 2 deletions src/main/java/storage/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class Storage {
* @param listOfTask The task list to save.
*/
public static void save(ArrayList<Task> listOfTask) throws DukeSaveException {
File writeData = new File("./src/data/duke.txt");
File writeData = new File("./duke/data/duke.txt");
try {
writeData.createNewFile();
FileWriter writer = new FileWriter(writeData);
Expand Down Expand Up @@ -77,10 +77,14 @@ private static String load(ListOfTask taskList, int startLine, String errorCarry
assert(startLine > 0);
assert(errorCarryForward != null);

File saveData = new File("./src/data/duke.txt");
File holderDirectory = new File("./duke");
File saveDirectory = new File("./duke/data");
File saveData = new File("./duke/data/duke.txt");
String error = null;

try {
holderDirectory.mkdir();
saveDirectory.mkdir();
saveData.createNewFile();
Scanner readData = new Scanner(saveData);

Expand Down
24 changes: 18 additions & 6 deletions src/main/resources/view/DialogBox.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,39 @@
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>

<fx:root alignment="TOP_CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" nodeOrientation="LEFT_TO_RIGHT" prefHeight="123.0" prefWidth="400.0" type="javafx.scene.layout.HBox" xmlns="http://javafx.com/javafx/20.0.1" xmlns:fx="http://javafx.com/fxml/1">
<fx:root alignment="TOP_RIGHT" nodeOrientation="LEFT_TO_RIGHT" style="-fx-background-color: grey; -fx-border-color: black;" type="javafx.scene.layout.HBox" xmlns="http://javafx.com/javafx/20.0.1" xmlns:fx="http://javafx.com/fxml/1">
<children>
<ScrollPane fitToHeight="true" fitToWidth="true" hbarPolicy="NEVER" prefHeight="99.0" prefWidth="287.0">
<ScrollPane hbarPolicy="NEVER" style="-fx-background-color: grey;">
<content>
<VBox maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="64.0" prefWidth="285.0">
<VBox>
<children>
<Label fx:id="dialog" alignment="TOP_LEFT" maxHeight="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" prefWidth="264.0" text="Label" wrapText="true">
<Label fx:id="dialog" alignment="TOP_LEFT" text="Label" wrapText="true">
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
</Label>
</children>
<padding>
<Insets right="10.0" />
</padding>
</VBox>
</content>
<opaqueInsets>
<Insets />
</opaqueInsets>
<HBox.margin>
<Insets left="3.0" right="3.0" />
<Insets />
</HBox.margin>
</ScrollPane>
<ImageView fx:id="displayPicture" fitHeight="99.0" fitWidth="99.0" pickOnBounds="true" preserveRatio="true" />
<ImageView fx:id="displayPicture" fitHeight="99.0" fitWidth="99.0" pickOnBounds="true" preserveRatio="true" style="-fx-opacity: 100;" HBox.hgrow="NEVER">
<HBox.margin>
<Insets right="5.0" />
</HBox.margin></ImageView>
</children>
<padding>
<Insets bottom="15.0" left="5.0" right="5.0" top="15.0" />
</padding>
<opaqueInsets>
<Insets />
</opaqueInsets>
</fx:root>
10 changes: 7 additions & 3 deletions src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>

<AnchorPane xmlns="http://javafx.com/javafx/20.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gui.MainWindow">
<AnchorPane prefHeight="429.0" prefWidth="400.0" style="-fx-background-color: black;" xmlns="http://javafx.com/javafx/20.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gui.MainWindow">
<children>
<ScrollPane fx:id="scrollPane" hbarPolicy="NEVER" hvalue="1.0" prefHeight="510.0" prefWidth="400.0" vvalue="1.0" AnchorPane.bottomAnchor="47.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<ScrollPane fx:id="scrollPane" fitToHeight="true" fitToWidth="true" hbarPolicy="NEVER" hvalue="1.0" style="-fx-background-color: transparent;" vvalue="1.0" AnchorPane.bottomAnchor="47.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<content>
<VBox fx:id="dialogContainer" alignment="TOP_CENTER" prefHeight="507.0" prefWidth="384.0" />
<VBox fx:id="dialogContainer" alignment="TOP_CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" style="-fx-background-color: grey;">
<padding>
<Insets right="5.0" />
</padding></VBox>
</content>
</ScrollPane>
<HBox layoutX="326.0" layoutY="514.0" prefHeight="41.0" prefWidth="72.0" AnchorPane.bottomAnchor="2.0" AnchorPane.rightAnchor="2.0">
Expand Down

0 comments on commit a6f7220

Please # to comment.