MenueController Button highlight

This commit is contained in:
Richard Reiswich 2023-01-31 21:26:41 +01:00
parent 3f3875fd78
commit b456b6d1d8
2 changed files with 99 additions and 55 deletions

View File

@ -1,25 +1,99 @@
/**
* Author: Reshad Meher
* Startseite
* fxml: menue-view.fxml
*/
package com.bib.essensbestellungsverwaltung; package com.bib.essensbestellungsverwaltung;
import javafx.event.ActionEvent; import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader; import javafx.scene.Node;
import javafx.scene.Parent; import javafx.scene.control.*;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.stage.Stage;
import java.io.IOException;
public class MenueController { public class MenueController {
@FXML @FXML
private void onBtLoginClick(){ Button btFirstMealMon;
Alert alert = new Alert(Alert.AlertType.ERROR, "Hi"); @FXML
alert.showAndWait(); Button btSecondMealMon;
@FXML
Button btNoMealMon;
@FXML
Button btFirstDessertMon;
@FXML
Button btSecondDessertMon;
@FXML
Button btNoDessertMon;
@FXML
Button btFirstMealTue;
@FXML
Button btSecondMealTue;
@FXML
Button btNoMealTue;
@FXML
Button btFirstDessertTue;
@FXML
Button btSecondDessertTue;
@FXML
Button btNoDessertTue;
@FXML
Button btFirstMealWed;
@FXML
Button btSecondMealWed;
@FXML
Button btNoMealWed;
@FXML
Button btFirstDessertWed;
@FXML
Button btSecondDessertWed;
@FXML
Button btNoDessertWed;
@FXML
Button btFirstMealThu;
@FXML
Button btSecondMealThu;
@FXML
Button btNoMealThu;
@FXML
Button btFirstDessertThu;
@FXML
Button btSecondDessertThu;
@FXML
Button btNoDessertThu;
@FXML
Button btFirstMealFri;
@FXML
Button btSecondMealFri;
@FXML
Button btNoMealFri;
@FXML
Button btFirstDessertFri;
@FXML
Button btSecondDessertFri;
@FXML
Button btNoDessertFri;
@FXML
ComboBox<String> cbPickChild;
@FXML
Button btLogin;
@FXML
Button btSaveOrder;
@FXML
ListView<String> lvFoodInfo;
public ObservableList<Node> buttons = FXCollections.observableArrayList();
public void setButtonActive(Button b){
getSiblings(b);
for(Node button : buttons){
button.getStyleClass().remove("active");
if (button.equals(b)){
b.getStyleClass().add("active");;
}
}
} }
public ObservableList<Node> getSiblings(Button b) {
javafx.scene.Parent p = b.getParent();
buttons = p.getChildrenUnmodifiable();
return buttons;
}
} }

View File

@ -1,40 +1,10 @@
#btFoodChoice{ .sidebar-nav_button {
-fx-background-color: transparent; -fx-background-color: #69b6ff;
-fx-text-fill: #123;
-fx-border-color: #000;
-fx-border-radius: 20;
}
.sidebar-nav_button.active {
-fx-background-color: #4e92b4;
} }
#btFoodChoice:hover{
-fx-underline: true;
-fx-text-fill: black;
}
#btPlaceOrder{
-fx-background-color: lightblue;
-fx-text-fill: white;
-fx-background-radius: 25;
}
#btLogin{
-fx-background-color: #9ac1ce;
-fx-text-fill: white;
}
#btLogin:hover{
-fx-underline: true;
-fx-text-fill: black;
}
#btPlaceOrder:hover{
-fx-border-width: 0;
-fx-text-fill: black;
-fx-underline: true;
}
#cbChooseChild{
-fx-background-color: #9ac1ce;
-fx-prompt-text-fill: white;
}
#btFoodChoice:hover{
-fx-underline: true;
-fx-text-fill: black;
}