MenueController Button highlight

This commit is contained in:
Richard Reiswich 2023-02-01 17:45:40 +01:00
parent 3613e246c9
commit ba3b92b3c4

View File

@ -7,6 +7,8 @@ import javafx.scene.Node;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.input.MouseEvent; import javafx.scene.input.MouseEvent;
import java.util.HashMap;
public class MenueController { public class MenueController {
@FXML @FXML
@ -80,19 +82,13 @@ public class MenueController {
public ObservableList<Node> buttons = FXCollections.observableArrayList(); public ObservableList<Node> buttons = FXCollections.observableArrayList();
public void setButtonActive(){
} public void setButtonActive(ActionEvent event) {
Button b = (Button) event.getSource();
public ObservableList<Node> getSiblings(Button b) {
javafx.scene.Parent p = b.getParent(); javafx.scene.Parent p = b.getParent();
buttons = p.getChildrenUnmodifiable(); buttons = p.getChildrenUnmodifiable();
return buttons;
}
public void setButtonActive(Button b) {
getSiblings(b);
for(Node button : buttons){ for(Node button : buttons){
b.getStyleClass().remove("active"); b.getStyleClass().remove("active");
System.out.println(b.getStyleClass()); System.out.println(b.getStyleClass());