Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the color of treeitem expand and collapse arrow in javafx?

I have got some trouble with treeitems of a treeview. There are expand and collapse icon-arrows, when you have child-treeitems. I only know how to change the background-color of this expand/collapse icons. But I don't know how to change the color of the arrow.

.tree-cell .tree-disclosure-node {
    -fx-background-color: #CCCCCC;
}

.tree-cell:expanded .tree-disclosure-node {
     -fx-color: #CCCCCC;
}

Is there any chance to change the color of this arrow? I don't want to use self drawing icons. I just want to change the color of the arrow.

like image 512
apolol92 Avatar asked Feb 10 '23 18:02

apolol92


1 Answers

According to TreeViewSkin, the disclosure node is a StackPane, and has as a child another StackPane with style class arrow.

If you want to change the default color of this node, just add the color for the arrow class:

.tree-cell > .tree-disclosure-node > .arrow  {
    -fx-background-color: red;
}
.tree-cell:expanded > .tree-disclosure-node > .arrow {
    -fx-background-color: blue;
}
like image 99
José Pereda Avatar answered Feb 17 '23 03:02

José Pereda