mardi 15 mars 2016

Java FX Property binding for checkboxes

I have a Java FX project in NetBeans, which I have created a FXML file via scene builder. I have also created check boxes based on data collected from a web service. What I am trying to do is bind the properties of the checkboxes to the property of the graphs that I have created in scene builder.

//This is my Bar Chart declared from scene builder 
@FXML
private BarChart<?, ?> BarChart1;
//This is the Array of Checkboxes
checkBoxes = new CheckBox[Year.size()];
            EventHandler<ActionEvent> eh = new EventHandler<ActionEvent>() {
                @Override
                public void handle (ActionEvent e){
                    System.out.println("worked");
                    constructSeries();
                }
            };

            // for loop to run through the data to retrieve the years
            for (byte index = 0; index < Year.size(); index++) {
                checkBoxes[index] = new CheckBox(Year.get(index));
                checkBoxes[index].setSelected(true);
                checkBoxes[index].setOnAction(eh);

                CheckBoxes.getChildren().add(checkBoxes[index]);
            }
//This is where my check boxes are declared
private CheckBox[] checkBoxes;


}




Aucun commentaire:

Enregistrer un commentaire