I have a tableview that has a column dedicated to show a name and another to show a checkbox. The following code is the FXML code for the column.:
@FXML
private TableColumn<AttendanceMarkModel, CheckBox> allCheckBoxColumn;
The AttendanceMarkModel is a class used to store an id, a name and a checkbox. I have an ObservableList(obList) of type AttendanceMarkModel and I have added data to it by getting data from the database and passing a new checkbox.
obList.add(new AttendanceMarkModel(AttendanceRs.getInt("teacher_id"), AttendanceRs.getString("teacher_fname"), new Checkbox("")));
Then, I have assigned the columns as follows:
allCheckBoxColumn.setCellValueFactory(new PropertyValueFactory<>(("checkbox")));
After that, I have set the obList to my tableview. The name is displayed properly but for the checkbox column, a graphical checkbox is not shown. Instead "java.awt.checkbox[checkbox0,0,0,0,x0,invalid,label=,state=false]" line is shown for all the rows of the checkbox column.
Please help me on displaying the checkbox properly.
Aucun commentaire:
Enregistrer un commentaire