3

我尝试用我的图标替换 TreeView 中的默认箭头图标。问题是我的图标被裁剪了,尽管它只有 9x9 像素。要替换图标,我按照 stackoverflow 上的建议使用 CSS:

.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");
}

但这使我的小图标被裁剪(剪切):

在此处输入图像描述

我试图通过使用 css 和填充来改变这一点,但它没有帮助。

谢谢!

4

1 回答 1

2

使用 9*9 图标并给出 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");
}
于 2014-01-31T22:29:43.160 回答