From 6e208388950b83e666ed5558745ea418cc05e469 Mon Sep 17 00:00:00 2001
From: Harry Linrui XU <xulr0820@hotmail.com>
Date: Wed, 22 Mar 2023 11:08:18 +0100
Subject: [PATCH] Binded date and descriptionfields in dialog box with the
 chosen expense values

---
 .../idatt1002/demo/controller/AddExpenseController.java     | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/main/java/no/ntnu/idatt1002/demo/controller/AddExpenseController.java b/src/main/java/no/ntnu/idatt1002/demo/controller/AddExpenseController.java
index 93956647..2d18fcc8 100644
--- a/src/main/java/no/ntnu/idatt1002/demo/controller/AddExpenseController.java
+++ b/src/main/java/no/ntnu/idatt1002/demo/controller/AddExpenseController.java
@@ -71,12 +71,10 @@ public class AddExpenseController {
 
   public void setExpense(Expense expense) {
     this.newExpense = expense;
-    StringProperty dateProperty = new SimpleStringProperty(expense.getDate());
-    StringProperty descriptionProperty = new SimpleStringProperty(expense.getDescription());
 
-    dateField.textProperty().bindBidirectional(dateProperty);
+    dateField.textProperty().bindBidirectional(expense.dateProperty());
     amountField.textProperty().bindBidirectional(expense.amountProperty(), NumberFormat.getNumberInstance());
-    descriptionField.textProperty().bindBidirectional(descriptionProperty);
+    descriptionField.textProperty().bindBidirectional(expense.descriptionProperty());
   }
   public void pressOkBtn(ActionEvent event) {
     String date = dateField.getText();
-- 
GitLab