private void createCheckboxes ( ) { node . getChildren ( ) . clear ( ) ; checkboxes . clear ( ) ; for ( int i = 0 ; i < field . getItems ( ) . size ( ) ; i ++ ) { CheckBox cb = new CheckBox ( ) ; cb . setText ( field . getItems ( ) . get ( i ) . toString ( ) ) ; cb . setSelected ( field . getSelection ( ) . contains ( field . getItems ( ) . get ( i ) ) ) ; checkboxes . add ( cb ) ; } node . getChildren ( ) . addAll ( checkboxes ) ; }
This method creates node and adds them to checkboxes and is used when the itemsProperty on the field changes .