繁体   English   中英

使用 CSS 更改 JavaFX 中 TreeView 的样式

[英]Changing the style of a TreeView in JavaFX with CSS

i'm trying to style a TreeView in JavaFX using the CSS file, but there's a thing i can't understand: I'd like my TreeView to appear with the lines like in this picture , but i obtain them only like this . 有没有办法做到这一点?

/**
 * 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 */
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM