使用 CSS 更改 JavaFX 中 TreeView 的样式



我正在尝试使用 CSS 文件在 JavaFX 中设置树视图样式,但有一件事我无法理解: 我希望我的树视图与线条一起显示 就像这张照片一样,但我只这样获得它们。 有没有办法实现这一目标?

/**
* the disclosure node is a StackPane, and has as a child another StackPane with style class arrow
*/
.tree-table-row-cell > .tree-disclosure-node > .arrow,
.tree-table-row-cell:expanded > .tree-disclosure-node > .arrow{
-fx-background-color: transparent;
}
.tree-table-row-cell > .tree-disclosure-node{
-fx-background-image: url("/icons/icons8_stop_sign_100px_1.png"); /* Url of the icon */
-fx-background-size: 90% 90%; /* Can be `cover` or `100% 100%` ect. */
-fx-background-repeat: no-repeat;
-fx-background-position: center center; /* Put the icon in the center */
}
.tree-table-row-cell:expanded > .tree-disclosure-node {
-fx-background-image: url("/icons/icons8_new_moon_100px_1.png"); /* Url of the icon */
-fx-background-size: 90% 90%; /* Can be `cover` or `100% 100%` ect. */
-fx-background-repeat: no-repeat;
-fx-background-position: center center; /* Put the icon in the center */
}

最新更新