steff9488 steff9488 - 5 months ago 124
CSS Question

JavaFX change the blue color of the TableView selection row bar

Everything I found searching for an hour does not work in my

TableView
with javaFX8, the selection row bar still is always blue.

Tried all of this:

Javafx ListView selection bar text color when using CellFactory

How do i change the color of the blue
TableView
selection row bar?

tableView.setStyle("...");?


As you can see in the screenshot I have different text styles set in the cellFactory of some columns and it's hard to read with this dark-blue.

Answer

Have you tried to set the CSS style class?

.table-row-cell:selected {
    -fx-background-color: #005797;
    -fx-background-insets: 0;
    -fx-background-radius: 1;
}

Put this code in a CSS file and then add the file to the list of CSS stylesheets of the table view.