Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You need to set a CellFactory on the TableColumn.</p> <p>For example:</p> <pre><code>Callback&lt;TableColumn&lt;TableData, Boolean&gt;, TableCell&lt;TableData, Boolean&gt;&gt; booleanCellFactory = new Callback&lt;TableColumn&lt;TableData, Boolean&gt;, TableCell&lt;TableData, Boolean&gt;&gt;() { @Override public TableCell&lt;TableData, Boolean&gt; call(TableColumn&lt;TableData, Boolean&gt; p) { return new BooleanCell(); } }; active.setCellValueFactory(new PropertyValueFactory&lt;TableData,Boolean&gt;("active")); active.setCellFactory(booleanCellFactory); class BooleanCell extends TableCell&lt;TableData, Boolean&gt; { private CheckBox checkBox; public BooleanCell() { checkBox = new CheckBox(); checkBox.setDisable(true); checkBox.selectedProperty().addListener(new ChangeListener&lt;Boolean&gt; () { public void changed(ObservableValue&lt;? extends Boolean&gt; observable, Boolean oldValue, Boolean newValue) { if(isEditing()) commitEdit(newValue == null ? false : newValue); } }); this.setGraphic(checkBox); this.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); this.setEditable(true); } @Override public void startEdit() { super.startEdit(); if (isEmpty()) { return; } checkBox.setDisable(false); checkBox.requestFocus(); } @Override public void cancelEdit() { super.cancelEdit(); checkBox.setDisable(true); } public void commitEdit(Boolean value) { super.commitEdit(value); checkBox.setDisable(true); } @Override public void updateItem(Boolean item, boolean empty) { super.updateItem(item, empty); if (!isEmpty()) { checkBox.setSelected(item); } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload