java - JavaFX-8 set color for selected TableRow -
i have code tablecells in .css file:
.table-cell-warn { -fx-background-color: aliceblue; } .table-cell-error { -fx-background-color: yellow; }
i have added css classes specific tablecells via. o.getstyleclass.add("table-cell-warn")
or o.getstyleclass.add("table-cell-error")
but when select colored tablerow now, not use colors specified selected tablerows (by default light blue). tried adding code this:
.table-cell-warn:selected { -fx-background-color: #0096c9; -fx-accent: #0096c9; -fx-focus-color: #039ed3; } .table-cell-error:selected { -fx-background-color: #0096c9; -fx-accent: #0096c9; -fx-focus-color: #039ed3; }
to .css file, changed nothing. have change in java code, too? or on wrong path.
the tableview
in "row selection mode", why :selected
pseudoclass added tablerow
containing tablecell
. following css should work:
/* row selection mode */ .table-row-cell:selected .table-cell-warn, .table-row-cell:selected .table-cell-error, /* cell selection mode */ .table-cell-warn:selected, .table-cell-error:selected { -fx-background-color: #0096c9; -fx-accent: #0096c9; -fx-focus-color: #039ed3; }
Comments
Post a Comment