Javafx - How to set selected row text color in unfocused TableView

My application uses row select mode ( table.setCellSelectionEnabled(false))

In my CSS:

.table-row-cell:selected {
   -fx-background-color: steelblue; 
   -fx-text-fill: red !important;
}

the property is -fx-background-colorworking fine but -fx-text-fillnot working. The text color of the selected line is black (if TableViewnot focused) or white (if focused TableView).

+3
source share
2 answers

This works for me, although there may be simpler ways:

.table-row-cell:selected {
   -fx-background-color: steelblue; 
}
.table-row-cell:selected .text {
       -fx-fill: red ;

}
+13
source

JavaFX 8, Modena, ( , ). , ( ):

.table-row-cell:selected {
   -fx-background-color: steelblue; 
   -fx-text-background-color: red;
}
+3

All Articles