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

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -