From 1a4d45aed479c8d69ae996dbcf4840f90aa8f3fe Mon Sep 17 00:00:00 2001 From: Johannes Kantz <67144859+JohannesKantz@users.noreply.github.com> Date: Tue, 31 Jan 2023 04:30:09 +0100 Subject: [PATCH] add: parent menu --- .../ParentMenuController.java | 78 ++++++++++++++++++ .../bib/essensbestellungsverwaltung/menue.css | 30 ++----- .../parentMenu.fxml | 81 +++++++++++++++++++ 3 files changed, 166 insertions(+), 23 deletions(-) create mode 100644 src/main/java/com/bib/essensbestellungsverwaltung/ParentMenuController.java create mode 100644 src/main/resources/com/bib/essensbestellungsverwaltung/parentMenu.fxml diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/ParentMenuController.java b/src/main/java/com/bib/essensbestellungsverwaltung/ParentMenuController.java new file mode 100644 index 0000000..f42f378 --- /dev/null +++ b/src/main/java/com/bib/essensbestellungsverwaltung/ParentMenuController.java @@ -0,0 +1,78 @@ +package com.bib.essensbestellungsverwaltung; + +import javafx.fxml.FXML; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.control.Button; +import javafx.scene.input.ContextMenuEvent; +import javafx.scene.input.MouseEvent; +import javafx.scene.layout.Background; +import javafx.scene.layout.BorderPane; + +import java.io.IOException; +import java.util.Arrays; + +public class ParentMenuController { + + @FXML + BorderPane contentView; + @FXML + Button essensplanButton; + @FXML + Button kinderButton; + @FXML + Button bestellungButton; + @FXML + Button einstellungenButton; + + @FXML + public void initialize() { + changePage("menue-view.fxml"); + setButtonActive(essensplanButton); + } + + + @FXML + public void onEssensplanClick(MouseEvent mouseEvent) { + setButtonActive(essensplanButton); + changePage("menue-view.fxml"); + } + + @FXML + public void onKinderClick(MouseEvent mouseEvent) { + setButtonActive(kinderButton); + changePage("child-view.fxml"); + } + + @FXML + public void onBestellungClick(MouseEvent mouseEvent) { + setButtonActive(bestellungButton); + changePage("dailyOrder-view.fxml"); + } + + @FXML + public void onEinstellungenClick(MouseEvent mouseEvent) { + setButtonActive(einstellungenButton); + changePage("menue-view.fxml"); + } + + @FXML + public void onAusloggenClick(MouseEvent mouseEvent) { + } + + private void changePage(String page) { + try { + Parent root = FXMLLoader.load(getClass().getResource(page)); + contentView.setCenter(root); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + private void setButtonActive(Button b){ + einstellungenButton.getStyleClass().remove("active"); + kinderButton.getStyleClass().remove("active"); + bestellungButton.getStyleClass().remove("active"); + essensplanButton.getStyleClass().remove("active"); + b.getStyleClass().add("active"); + } +} diff --git a/src/main/resources/com/bib/essensbestellungsverwaltung/menue.css b/src/main/resources/com/bib/essensbestellungsverwaltung/menue.css index 1ed99ac..8ea9a07 100644 --- a/src/main/resources/com/bib/essensbestellungsverwaltung/menue.css +++ b/src/main/resources/com/bib/essensbestellungsverwaltung/menue.css @@ -1,25 +1,9 @@ -#btFoodChoice{ - -fx-background-color: transparent; - +.sidebar-nav_button { + -fx-background-color: #69b6ff; + -fx-text-fill: #123; + -fx-border-color: #000; + -fx-border-radius: 20; } - -#btFoodChoice:hover{ - -fx-underline: true; - -fx-text-fill: black; -} -#btPlaceOrder{ - -fx-background-color: lightblue; - -fx-text-fill: white; - -fx-background-radius: 25; -} - - -#btPlaceOrder:hover{ - -fx-border-width: 0; - -fx-text-fill: black; - -fx-underline: true; -} - -#cbChooseChild{ - -fx-background-color: lightgray; +.sidebar-nav_button.active { + -fx-background-color: #4e92b4; } \ No newline at end of file diff --git a/src/main/resources/com/bib/essensbestellungsverwaltung/parentMenu.fxml b/src/main/resources/com/bib/essensbestellungsverwaltung/parentMenu.fxml new file mode 100644 index 0000000..40a5e8b --- /dev/null +++ b/src/main/resources/com/bib/essensbestellungsverwaltung/parentMenu.fxml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+