Change expand and collapse image TreeView JavaFX 2.2
Asked Answered
M

1

5

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

Change this image,

Valid XHTML

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

Valid XHTML

Machismo answered 20/3, 2013 at 11:7 Comment(0)
J
9

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

Jandel answered 15/4, 2013 at 13:4 Comment(1)
I added icons on 16x16 pixel dimension but they were cropped. On 10x10 pixels they were displayed great. Thank you.Machismo

© 2022 - 2024 — McMap. All rights reserved.