Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display my icon instead of arrow in TreeView?

I try to replace default arrow icon in TreeView with my icon. The problem is that my icon is cropped although it is only 9x9 pixels. To replace icon I use CSS as suggested on stackoverflow:

.tree-cell > .tree-disclosure-node > .arrow {
    -fx-background-color: null;
    -fx-background-image: url("plus-icon.gif");
}

.tree-cell:expanded > .tree-disclosure-node > .arrow {
    -fx-background-color: null;
    -fx-background-image: url("minus-icon.gif");
}

But this makes my tiny icon cropped(cut):

enter image description here

I tried to change this by playing with css and padding but it does not help.

Thank you!

like image 978
Volodymyr Levytskyi Avatar asked Jan 27 '26 03:01

Volodymyr Levytskyi


1 Answers

Use 9*9 icons and also given CSS:

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

.tree-cell:expanded .tree-disclosure-node .arrow {
-fx-shape: null;
-fx-background-color: null;
-fx-background-image: url("minus-icon.gif");
}
like image 83
user2036144 Avatar answered Jan 28 '26 15:01

user2036144



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!