I have the next function:
tableSoldCoffees.setRowFactory(typesOfCoffeesTableView -> new TableRow<TypesOfCoffees>() {
@Override
protected void updateItem(TypesOfCoffees item, boolean empty) {
super.updateItem(item, empty);
if (isSelected()) {
setStyle("-fx-background-color: #74512D");
} else if (!isSelected()) {
setStyle("");
}
}
});
Here, in the table-view, when the item is selected the function changes the bakcground of the row, but i don’t know how to reach “-fx-text-fill” and change color of the text itself. If i write it inside, it will not work.
I can change in the CSS stylesheet:
.myTable .table-row-cell:selected .table-cell{
-fx-text-fill: white;
}
But i need to do this particularly in the code
New contributor
GekaCool is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.