Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaFX is there anyway to set the two colors of a selected treeview item using css

Is there any way to change the color of a selected TreeView item, instead of the default red and blue color that shows when a TreeItem is selected

Screenshot of what I want to change

like image 349
Tule Simon Avatar asked Jan 24 '20 08:01

Tule Simon


1 Answers

This is not a standard java TreeView, I noticed that you're using JFoenix's tree view JFXTreeView. You can change the color of this selection bar by applying:

.tree-cell .selection-bar {
    -fx-background-color: green;
}

To change that background color:

.tree-cell:selected { 
    -fx-background-color: green; 
}
like image 168
Miss Chanandler Bong Avatar answered Oct 03 '22 14:10

Miss Chanandler Bong