I have my UIController class and a ButtonMethods class. The ButtonMethods class contains all the code for the button actions. I need to be able to use the buttons from the controller class in the ButtonMethods class. For example, I have these defined in the controller class
ButtonMethods button = new ButtonMethods();
@FXML Button buttonLockdown;
@FXML Button buttonRelease;
And for example, the buttonLockdown has an ActionEvent when clicked
@FXML
private void actionLockdown(ActionEvent event) {
button.lockdown();
Ideally, I want the ButtonMethods to do this:
public void lockdown() {
buttonLockdown.setDisable(true);
onLockdown = true;
buttonRelease.setDisable(false);
I can't just put that code into the action event for various reasons, and putting the button objects into the parameters would get too messy with what I'm trying to do. So how can I get FXML objects into the button class?