From b7bc440a4fe3c2777bfa21a67177bfd283e92fac Mon Sep 17 00:00:00 2001 From: Richard Date: Wed, 1 Feb 2023 09:25:40 +0100 Subject: [PATCH] MenueController Button highlight --- .../MenueController.java | 173 ++++++++++- .../menue-view.fxml | 290 ++++++++++-------- 2 files changed, 330 insertions(+), 133 deletions(-) diff --git a/src/main/java/com/bib/essensbestellungsverwaltung/MenueController.java b/src/main/java/com/bib/essensbestellungsverwaltung/MenueController.java index 5214014..dc0834e 100644 --- a/src/main/java/com/bib/essensbestellungsverwaltung/MenueController.java +++ b/src/main/java/com/bib/essensbestellungsverwaltung/MenueController.java @@ -1,9 +1,11 @@ package com.bib.essensbestellungsverwaltung; import javafx.collections.FXCollections; import javafx.collections.ObservableList; +import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.Node; import javafx.scene.control.*; +import javafx.scene.input.MouseEvent; public class MenueController { @@ -78,15 +80,8 @@ public class MenueController { public ObservableList buttons = FXCollections.observableArrayList(); - public void setButtonActive(Button b){ - getSiblings(b); - for(Node button : buttons){ - button.getStyleClass().remove("active"); + public void setButtonActive(){ - if (button.equals(b)){ - b.getStyleClass().add("active");; - } - } } public ObservableList getSiblings(Button b) { @@ -96,4 +91,166 @@ public class MenueController { } + public void setButtonActive(Button b) { + getSiblings(b); + for(Node button : buttons){ + b.getStyleClass().remove("active"); + + + if (button.equals(b)){ + b.getStyleClass().add("active");; + } + } + } + + @FXML + public void onBtFirstMealMonClick(MouseEvent mouseEvent) { + setButtonActive(btFirstMealMon); + } + + @FXML + public void onBtSecondMealMonClick(MouseEvent mouseEvent) { + setButtonActive(btSecondMealMon); + } + + @FXML + public void onBtNoMealMonClick(MouseEvent mouseEvent) { + setButtonActive(btNoMealMon); + } + + @FXML + public void onBtFirstDessertMonClick(MouseEvent mouseEvent) { + setButtonActive(btFirstDessertMon); + } + + @FXML + public void onBtSecondDessertMonClick(MouseEvent mouseEvent) { + setButtonActive(btSecondDessertMon); + } + + @FXML + public void onBtNoDessertMonClick(MouseEvent mouseEvent) { + setButtonActive(btNoDessertMon); + } + + @FXML + public void onBtFirstMealTueClick(MouseEvent mouseEvent) { + setButtonActive(btFirstMealTue); + } + + @FXML + public void onBtSecondMealTueClick(MouseEvent mouseEvent) { + setButtonActive(btSecondMealTue); + } + + @FXML + public void onBtNoMealTueClick(MouseEvent mouseEvent) { + setButtonActive(btNoMealTue); + } + + @FXML + public void onBtFirstDessertTueClick(MouseEvent mouseEvent) { + setButtonActive(btFirstDessertTue); + } + + @FXML + public void onBtSecondDessertTueClick(MouseEvent mouseEvent) { + setButtonActive(btSecondDessertTue); + } + + @FXML + public void onBtNoDessertTueClick(MouseEvent mouseEvent) { + setButtonActive(btNoDessertTue); + } + + @FXML + public void onBtFirstMealWedClick(MouseEvent mouseEvent) { + setButtonActive(btFirstMealWed); + } + + @FXML + public void onBtSecondMealWedClick(MouseEvent mouseEvent) { + setButtonActive(btSecondMealWed); + } + /* + @FXML + public void onBtFirstMealMonClick(MouseEvent mouseEvent) { + setButtonActive(btFirstMealMon); + } + + @FXML + public void onBtFirstMealMonClick(MouseEvent mouseEvent) { + setButtonActive(btFirstMealMon); + } + + @FXML + public void onBtFirstMealMonClick(MouseEvent mouseEvent) { + setButtonActive(btFirstMealMon); + } + + @FXML + public void onBtFirstMealMonClick(MouseEvent mouseEvent) { + setButtonActive(btFirstMealMon); + } + + @FXML + public void onBtFirstMealMonClick(MouseEvent mouseEvent) { + setButtonActive(btFirstMealMon); + } + + @FXML + public void onBtFirstMealMonClick(MouseEvent mouseEvent) { + setButtonActive(btFirstMealMon); + } + + @FXML + public void onBtFirstMealMonClick(MouseEvent mouseEvent) { + setButtonActive(btFirstMealMon); + } + + @FXML + public void onBtFirstMealMonClick(MouseEvent mouseEvent) { + setButtonActive(btFirstMealMon); + } + + @FXML + public void onBtFirstMealMonClick(MouseEvent mouseEvent) { + setButtonActive(btFirstMealMon); + } + + @FXML + public void onBtFirstMealMonClick(MouseEvent mouseEvent) { + setButtonActive(btFirstMealMon); + } + + @FXML + public void onBtFirstMealMonClick(MouseEvent mouseEvent) { + setButtonActive(btFirstMealMon); + } + + @FXML + public void onBtFirstMealMonClick(MouseEvent mouseEvent) { + setButtonActive(btFirstMealMon); + } + + @FXML + public void onBtFirstMealMonClick(MouseEvent mouseEvent) { + setButtonActive(btFirstMealMon); + } + + @FXML + public void onBtFirstMealMonClick(MouseEvent mouseEvent) { + setButtonActive(btFirstMealMon); + } + + @FXML + public void onBtFirstMealMonClick(MouseEvent mouseEvent) { + setButtonActive(btFirstMealMon); + } + + @FXML + public void onBtFirstMealMonClick(MouseEvent mouseEvent) { + setButtonActive(btFirstMealMon); + } + */ } diff --git a/src/main/resources/com/bib/essensbestellungsverwaltung/menue-view.fxml b/src/main/resources/com/bib/essensbestellungsverwaltung/menue-view.fxml index 13dc480..7e273bd 100644 --- a/src/main/resources/com/bib/essensbestellungsverwaltung/menue-view.fxml +++ b/src/main/resources/com/bib/essensbestellungsverwaltung/menue-view.fxml @@ -11,129 +11,169 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + +