From 1a452513e9baac6a3de08ffaad5320ce71adb710 Mon Sep 17 00:00:00 2001
From: Harry Linrui XU <xulr0820@hotmail.com>
Date: Tue, 21 Mar 2023 15:03:37 +0100
Subject: [PATCH] Added initialize method and switch scene methods in
 MainMenuController

---
 .../demo/controller/MainMenuController.java   | 22 +++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/main/java/no/ntnu/idatt1002/demo/controller/MainMenuController.java b/src/main/java/no/ntnu/idatt1002/demo/controller/MainMenuController.java
index 84a7285c..275f86fb 100644
--- a/src/main/java/no/ntnu/idatt1002/demo/controller/MainMenuController.java
+++ b/src/main/java/no/ntnu/idatt1002/demo/controller/MainMenuController.java
@@ -9,8 +9,12 @@ import javafx.scene.Parent;
 import javafx.scene.Scene;
 import javafx.scene.control.Button;
 import javafx.scene.control.DatePicker;
+import javafx.scene.control.Label;
 import javafx.scene.control.ProgressBar;
+import javafx.scene.image.ImageView;
 import javafx.stage.Stage;
+import no.ntnu.idatt1002.demo.data.Economics.ItemRegister;
+import no.ntnu.idatt1002.demo.view.ExpenseRepository;
 
 public class MainMenuController {
 
@@ -28,9 +32,22 @@ public class MainMenuController {
 
     @FXML
     private DatePicker date;
+
     @FXML
-    public void initialize() {
+    private ImageView progressMarker;
+
+    @FXML
+    private Label today;
+
 
+    ExpenseRepository expenseRepository;
+    @FXML
+    public void initialize() {
+        progressbar.setProgress(0.5);
+        //progressbar.setProgress((ExpenseRepository.getSum())/5000);
+        System.out.println(progressbar.getProgress());
+        progressMarker.setTranslateX(-275 + progressbar.getProgress());
+        today.setTranslateX(-275 + progressbar.getProgress());
     }
 
     @FXML
@@ -40,7 +57,8 @@ public class MainMenuController {
         Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
         Scene scene = new Scene(root);
         stage.setScene(scene);
-        stage.show();    }
+        stage.show();
+    }
 
     @FXML
     public void switchOverview(ActionEvent event) throws IOException {
-- 
GitLab