@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
    System.out.println("confirmed");
    this.refreshData( e -> true);
    this.pieTriState.getData().forEach(this::clickOnPie);
    Arrays.stream(gList).forEach(e -> {
        var checkBox = new CheckBox(e.getState());
        checkBox.setPrefSize(60,15);
        this.fpStates.getChildren().add(checkBox);
        System.out.println(checkBox);
        checkBox.setOnAction((ActionEvent event) -> {
            if(checkBox.isSelected()){
                //I tried to count the checkbox by using this. but its not work for me
                for(int i =0; i <1; i++){
                    System.out.println(i);
                }
                System.out.println(checkBox.getText());
                //btnRefresh.setVisible(false);
                //lblStatus.setText("more than 4 states selected is invalid.");
            }
        });
    });
I am trying to count the checkbox. if 4 checkboxes are selected, so I can hide a button. But the problem is the checkbox is in the flow pane. So I don't know how to count it.
