In my Java Desktop Application I have a TableView in which I want to have a column with CheckBoxes.
I did find where this has been done http://www.jonathangiles.net/javafx/2.0/CellFactories/ but as the download is not available and because I don't know how soon Jonathan Giles will answer my email I thought I'd ask...
How do I put a CheckBox in a cell of my TableView?
Here's a 3rd party lib that will do it http://www.jonathangiles.net/javafx/2.0/CellFactories/docs/api/net/jonathangiles/javafx/control/cell/tableview/CheckBoxTableCell.html
You need to set a CellFactory on the TableColumn.
For example:
Here is a complete working example showing how to keep the model in sync with the view.....
The simplest solution in order to have an EDITABLE checkbox linked to the model is:
Assuming that you have a
Person
model class with two fields, a "name" string and the "selected" boolean value:All you have to do in the controller is:
Small and simple.