In my program I have this on the css file:
.error-row {
-fx-text-fill: red;
}
If the row in a table view is an error, it's text should be red. If is an error, I do getStyleClass().add("error-row");
in the factory, but it doesn't work. If I add things like background color and font weight int the css .error-row
, they work, but not the color. Anyone knows why?
I'm guessing that you are using a rowFactory
on the TableView
. The default css stylesheet defines the text fill on the table cell, which is a descendant of the table row, and so the default value overrides the value you set on the row.
Try
.error-row .table-cell {
-fx-text-fill: red ;
}