0

In JavaFx every row is by default white and on click action the background is blue and text color white. I changed the background of every odd row with css like this:

.table-row-cell:odd{
    -fx-background-color: #b3b300;
}

but I do not know how can i change the background and the text color when a row is selected Only for odd rows. For even rows i do not want to change anything.

  • Does `.table-row-cell:odd:selected` work for you? – Slaw May 15 '22 at 17:41
  • Search for the file `modena.css` which is located inside one of the JavaFX jars. It will have table styling rules and looked-up color names you can override in a custom style sheet, similar to the [procedure here](https://stackoverflow.com/questions/72181201/how-do-i-style-a-cell-in-the-date-picker-that-is-not-in-the-current-month/72208848#72208848), but applied to table view rather than date picker styles. – jewelsea May 15 '22 at 18:17

0 Answers0