dimanche 1 novembre 2020

How can i get the checkbox value from the controller class to use it in another class? JavaFX

I have this class called controller with a checkbox. I need to get this value in a class called Habitat because a method will do something according to that checkbox. I'm letting the checkbox as public static but it still saying cannot find symbol. I've imported the class too What should i do?

public class Controller {
...
 @FXML 
    public static Checkbox checkBoxRules;
...
}

public class Habitat {
...

 private void State() 
    {
        
        if (Controller.checkBoxRules.isSelected()) {
            ...
        }
}



Aucun commentaire:

Enregistrer un commentaire