Change expand and collapse image TreeView JavaFX 2.2

不羁的心 提交于 2019-11-27 08:03:26

问题


Is it possible to change the Expand and Collapse Images of a JavaFX 2.2 TreeVIew?

Change this image,

To an image like this (with +/-),


回答1:


Sure, this is possible with a little bit of css. The CSS looks like this:

.tree-cell .tree-disclosure-node .arrow {
    -fx-shape: null;
    -fx-background-color: null;
    -fx-background-image: url("plus-arrow.png");
}
.tree-cell:expanded .tree-disclosure-node .arrow {
    -fx-shape: null;
    -fx-background-color: null;
    -fx-background-image: url("minus-arrow.png");
}

lg Kalasch



来源:https://stackoverflow.com/questions/15521806/change-expand-and-collapse-image-treeview-javafx-2-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!