From e4eea60eb726a4c2a0709d6a9a1eaa36922079ac Mon Sep 17 00:00:00 2001 From: Harry Linrui XU <xulr0820@hotmail.com> Date: Thu, 20 Apr 2023 13:41:33 +0200 Subject: [PATCH] Linked food button in main menu to suggest recipe page --- src/main/java/no/ntnu/idatt1002/demo/controller/MainMenu.java | 2 +- src/main/resources/view/MainMenuNew.fxml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/no/ntnu/idatt1002/demo/controller/MainMenu.java b/src/main/java/no/ntnu/idatt1002/demo/controller/MainMenu.java index 71a7f39b..2d62ad8b 100644 --- a/src/main/java/no/ntnu/idatt1002/demo/controller/MainMenu.java +++ b/src/main/java/no/ntnu/idatt1002/demo/controller/MainMenu.java @@ -242,7 +242,7 @@ public class MainMenu { private void switchScene(ActionEvent event) throws IOException { FXMLLoader loader = new FXMLLoader(); if (event.getSource() == foodBtn) { - System.out.println("Food button pressed"); + loader.setLocation(getClass().getResource("/view/SuggestRecipes.fxml")); } else if (event.getSource() == expenseBtn) { loader.setLocation(getClass().getResource("/view/IncomeAndExpenses.fxml")); } else if (event.getSource() == incomeBtn) { diff --git a/src/main/resources/view/MainMenuNew.fxml b/src/main/resources/view/MainMenuNew.fxml index 4b685ffc..4acfebd9 100644 --- a/src/main/resources/view/MainMenuNew.fxml +++ b/src/main/resources/view/MainMenuNew.fxml @@ -188,7 +188,7 @@ </BorderPane> <TilePane alignment="CENTER" hgap="50.0" prefHeight="215.0" prefWidth="1131.0"> <children> - <Button fx:id="foodBtn" alignment="TOP_CENTER" contentDisplay="TOP" mnemonicParsing="false" prefHeight="100.0" prefWidth="150.0" text="Food"> + <Button fx:id="foodBtn" alignment="TOP_CENTER" contentDisplay="TOP" mnemonicParsing="false" onAction="#switchScene" prefHeight="100.0" prefWidth="150.0" text="Food"> <graphic> <ImageView fitHeight="75.0" fitWidth="75.0" pickOnBounds="true" preserveRatio="true"> <image> -- GitLab