3
我嘗試用我的圖標替換TreeView中的默認箭頭圖標。問題在於我的圖標雖然只有9x9像素,但已被裁剪。要更換圖標我使用CSS對計算器的建議:如何在TreeView中顯示我的圖標而不是箭頭?
.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和填充打去改變這一點,但它沒有幫助。
謝謝!
你需要的'-fx-'?它應該不僅僅是'background-image:url(「minus-icon.gif」);' – Pete
謝謝皮特!這是javafx和css選擇器非常相似,但帶有前綴-fx-。 –