From 8a5337ff966c1403a498ca454d095ac443331cf1 Mon Sep 17 00:00:00 2001 From: Harry Linrui XU <xulr0820@hotmail.com> Date: Tue, 18 Apr 2023 08:22:34 +0200 Subject: [PATCH] Made nodes in the two FXML files more common, as they share the same controller --- .../resources/view/IncomeAndExpenses.fxml | 7 +----- src/main/resources/view/dualList.fxml | 24 ++++++++++++------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/main/resources/view/IncomeAndExpenses.fxml b/src/main/resources/view/IncomeAndExpenses.fxml index d218d02d..f6ae580a 100644 --- a/src/main/resources/view/IncomeAndExpenses.fxml +++ b/src/main/resources/view/IncomeAndExpenses.fxml @@ -10,7 +10,6 @@ <?import javafx.scene.control.Label?> <?import javafx.scene.control.MenuButton?> <?import javafx.scene.control.MenuItem?> -<?import javafx.scene.control.ProgressBar?> <?import javafx.scene.control.TableColumn?> <?import javafx.scene.control.TableView?> <?import javafx.scene.image.Image?> @@ -103,11 +102,7 @@ </HBox> </left> <right> - <Pane BorderPane.alignment="CENTER"> - <children> - <ProgressBar fx:id="budgetProgress" prefWidth="200.0" progress="0.0" /> - </children> - </Pane> + <Pane BorderPane.alignment="CENTER" /> </right> <opaqueInsets> <Insets /> diff --git a/src/main/resources/view/dualList.fxml b/src/main/resources/view/dualList.fxml index 4b464415..07a3282c 100644 --- a/src/main/resources/view/dualList.fxml +++ b/src/main/resources/view/dualList.fxml @@ -2,8 +2,11 @@ <?import javafx.geometry.Insets?> <?import javafx.scene.Cursor?> +<?import javafx.scene.chart.PieChart?> <?import javafx.scene.control.Button?> <?import javafx.scene.control.ComboBox?> +<?import javafx.scene.control.DatePicker?> +<?import javafx.scene.control.Label?> <?import javafx.scene.control.MenuButton?> <?import javafx.scene.control.MenuItem?> <?import javafx.scene.control.TableColumn?> @@ -57,7 +60,7 @@ </StackPane> <StackPane> <children> - <TableView fx:id="expenseTableView" minWidth="300.0" prefHeight="260.0" prefWidth="485.0"> + <TableView fx:id="incomeTableView" minWidth="300.0" prefHeight="260.0" prefWidth="485.0"> <columns> <TableColumn fx:id="inDateCol" prefWidth="75.0" text="Date" /> <TableColumn fx:id="inAmountCol" prefWidth="75.0" text="Amount" /> @@ -70,6 +73,7 @@ </columnResizePolicy> </TableView> <Rectangle arcHeight="5.0" arcWidth="5.0" disable="true" fill="LIME" height="234.0" opacity="0.1" stroke="#d9cccc" strokeType="INSIDE" translateY="13.0" width="300.0" /> + <PieChart fx:id="incomePieChart" disable="true" opacity="0.0" prefHeight="1.0" prefWidth="1.0" visible="false" /> </children> </StackPane> <StackPane> @@ -77,13 +81,13 @@ <Rectangle arcHeight="5.0" arcWidth="5.0" fill="#f8f8f8" height="18.0" stroke="#d9cccc" strokeType="INSIDE" width="300.0" StackPane.alignment="TOP_LEFT" /> <HBox prefHeight="18.0" prefWidth="517.0"> <children> - <Text fx:id="inSum" strokeType="OUTSIDE" strokeWidth="0.0" text="Sum: "> + <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Sum: "> <HBox.margin> <Insets left="2.0" /> </HBox.margin> </Text> <Region prefHeight="18.0" prefWidth="74.0" /> - <Text fx:id="sum" strokeType="OUTSIDE" strokeWidth="0.0" text="Text" /> + <Label fx:id="inSum" text="Label" /> </children> </HBox> </children> @@ -100,7 +104,7 @@ </StackPane> <StackPane> <children> - <TableView fx:id="expenseTableView1" minWidth="300.0" prefHeight="260.0" prefWidth="485.0"> + <TableView fx:id="expenseTableView" minWidth="300.0" prefHeight="260.0" prefWidth="485.0"> <columns> <TableColumn fx:id="expDateCol" prefWidth="75.0" text="Date" /> <TableColumn fx:id="expAmountCol" prefWidth="75.0" text="Amount" /> @@ -113,6 +117,7 @@ </columnResizePolicy> </TableView> <Rectangle arcHeight="5.0" arcWidth="5.0" disable="true" fill="RED" height="234.0" opacity="0.1" stroke="RED" strokeType="INSIDE" translateY="13.0" width="300.0" /> + <PieChart fx:id="expensePieChart" disable="true" opacity="0.0" prefHeight="1.0" prefWidth="1.0" visible="false" /> </children> </StackPane> <StackPane> @@ -120,13 +125,13 @@ <Rectangle arcHeight="5.0" arcWidth="5.0" fill="#f8f8f8" height="18.0" stroke="#d9cccc" strokeType="INSIDE" width="300.0" StackPane.alignment="TOP_LEFT" /> <HBox prefHeight="18.0" prefWidth="517.0"> <children> - <Text fx:id="expSum" strokeType="OUTSIDE" strokeWidth="0.0" text="Sum: "> + <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Sum: "> <HBox.margin> <Insets left="2.0" /> </HBox.margin> </Text> <Region prefHeight="18.0" prefWidth="74.0" /> - <Text fx:id="sum1" strokeType="OUTSIDE" strokeWidth="0.0" text="Text" /> + <Label fx:id="expSum" text="Label" /> </children> </HBox> </children> @@ -170,7 +175,7 @@ </ComboBox> </children> </VBox> - <Button fx:id="returnBtn" mnemonicParsing="false" onAction="#returnToMainMenu" prefWidth="150.0" text="Continue" GridPane.columnIndex="1" GridPane.rowIndex="2"> + <Button fx:id="continueBtn" mnemonicParsing="false" onAction="#switchScene" prefWidth="150.0" text="Continue" GridPane.columnIndex="1" GridPane.rowIndex="2"> <GridPane.margin> <Insets bottom="5.0" /> </GridPane.margin> @@ -190,7 +195,7 @@ </HBox.margin> </Text> <Region prefHeight="18.0" prefWidth="100.0" /> - <Text fx:id="sum11" strokeType="OUTSIDE" strokeWidth="0.0" text="Text" /> + <Label fx:id="maxAmount" text="Label" /> </children> <StackPane.margin> <Insets bottom="4.0" /> @@ -202,11 +207,12 @@ </GridPane> </children> </VBox> - <Button layoutX="14.0" layoutY="14.0" mnemonicParsing="false" text="Return" /> + <Button fx:id="returnBtn" layoutX="14.0" layoutY="14.0" mnemonicParsing="false" onAction="#switchScene" text="Return" /> <Text layoutX="197.0" layoutY="60.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Income/Expenses" textAlignment="CENTER"> <font> <Font size="48.0" /> </font> </Text> + <DatePicker fx:id="date" disable="true" layoutX="340.0" layoutY="473.0" visible="false" /> </children> </AnchorPane> -- GitLab