javafx - JavaFx8 Table, Row Selection: Change color if table view has not focus -
how change row selection color if table view has not focus ? want color not change if focus lost.
my usecase have javafx dialog, in table view embedded . row selection can influenced hotkey. if user presses hotkey, row selection changes , set focus ok button of dialog. works row selection highlighting color looks not good, then.
in external css file, do
.table-row-cell:filled:selected, .table-row-cell:filled > .table-cell:selected { -fx-background: -fx-selection-bar; -fx-table-cell-border-color: derive(-fx-selection-bar, 20%); }
or, alternatively
.table-view { -fx-selection-bar-non-focused: -fx-selection-bar ; }
and of course use latter version set non-focused selection color choose.
(you directly in java
tableview.setstyle("-fx-selection-bar-non-focused: -fx-selection-bar ;");
but recommend putting in css file.)
Comments
Post a Comment