To enhance the appearance of certain rows in my table, I have customized their styles for highlighting purposes:
table.setRowFactory(tv -> new TableRow<TableBean>() {
@Override
public void updateItem(TableBean item, boolean empty) {
super.updateItem(item, empty);
if (item == null) {
setStyle("");
} else if (item.getComparisonElement().isMarker()) {
setStyle("-fx-border-color: red;");
} else {
setStyle("");
}
}
});
Although this method achieves the desired highlighting effect, it unfortunately causes some cells to become "shifted" as an unintended consequence: