I have checkboxes in a JavaFX TableView column. I am getting the checkboxes by reflection using this code:
List<? extends CheckBoxTableCell> checkboxCells = NodeTraverseHelper.getInstancesOf(attributeTable, CheckBoxTableCell.class);
for (CheckBoxTableCell<?, ?> cell : checkboxCells) {
CheckBox cb = (CheckBox) cell.lookup(CheckBox.class.getSimpleName());
// This call won't work
cb.setSelected(true);
}
As you can see from the code, I am trying to programmically check the checkbox by using cb.setSelected(true). For some reason, this code does not work. However, reading the current state of the checkbox via cb.isSelected() is working without any problems. Can anyone tell me how I can programmically select a checkbox within a TableView?
Aucun commentaire:
Enregistrer un commentaire