samedi 27 juillet 2019

How do I see if a specific CheckBox is selected within a GridPane?

I've created a 10x10 GridPane of CheckBoxes. I need to see whether a specific CheckBox is selected, but the GridPane is made up of nodes. So If I access a particular node using a function from another thread, I can't use isSelected because it is the wrong type.

I've tried modifying the function getNodeByRowColumnIndex or forcing the type to be CheckBox but I'm not sure how.

@FXML
private GridPane Grid;

@FXML
public void initialize() {
    for (int x = 0; x < 10; x++) {
        for (int y = 0; y < 10; y++) {
            this.Grid.add(new CheckBox(), x, y);
            //Problem here
            boolean bln = getNodeByRowColumnIndex(y,x,this.Grid).isSelected();
        }
    }
}




Aucun commentaire:

Enregistrer un commentaire