I'm trying to make a customized TreeView using CellFactory and Css.
This is what I have so far:
I want to center the arrow so that it points to the middle of the TreeCell.
Problem is, I don't know how. I have tried padding, but this only scales the icon.
It might be worth mentioning that the arrow is not part of the HBox I load in to represent the treeCell.
Here's my CSS:
.tree-cell{
-fx-content-display: CENTER;
-fx-position-shape: true;
-fx-background-color: linear-gradient(#c9e9d1 20%, #9dbda5 80%);
}
.tree-cell .tree-disclosure-node .arrow {
-fx-background-color: #facf46;
-fx-padding: 0.666666em; /* 4 */
-fx-shape: "M 0 -4 L 4 0 L 0 4 z";
-fx-content-display: center;
}
.tree-cell:expanded .tree-disclosure-node .arrow {
-fx-content-display: center;
-fx-background-color: #facf46,
-fx-rotate: 90;
}
.tree-cell:hover {
-fx-background-color: #dfffe7;
}
.tree-cell:selected{
-fx-background-color: #4f88da;
}
In these two links, there's code for how I represent TreCells by HBox:
Customizing TreeCells using cell factory JavaFX TreeView: setGraphic() for different levels of treeItem