I have the following piece of code to update both the color of a column cell and its corresponding row:
calltypel.setCellFactory(column -> {
r
private void customiseFactory(TableColumn calltypel) {
calltypel.setCellFactory(column -> {
return new TableCell() {
@Override
protected void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
setText(empty ? "" : getItem().toString());
setGraphic(null);
TableRow currentRow = getTableRow();
if (!isEmpty()) {
if(item.equals("a"))
currentRow.setStyle("-fx-background-color:lightcoral");
else
currentRow.setStyle("-fx-background-color:lightgreen");
}
}
};
});
}
This works!