gpt4 book ai didi

css - 自定义 Treecell : Placement of Arrow Icon

转载 作者:行者123 更新时间:2023-11-28 12:13:13 27 4
gpt4 key购买 nike

<分区>

我正在尝试使用 CellFactory 和 Css 制作自定义的 TreeView。

这是我目前所拥有的:

What I have so far

我想让箭头居中,使其指向 TreeCell 的中间。

问题是,我不知道怎么做。我试过填充,但这只会缩放图标。

可能值得一提的是,箭头不是我加载来表示 treeCell 的 HBox 的一部分。

这是我的 CSS:

.tree-cell{
-fx-content-display: CENTER;
-fx-position-shape: true;
-fx-background-color: linear-gradient(#c9e9d1 20%, #9dbda5 80%);
}
.tree-cell .tree-disclosure-node .arrow {
-fx-background-color: #facf46;
-fx-padding: 0.666666em; /* 4 */
-fx-shape: "M 0 -4 L 4 0 L 0 4 z";
-fx-content-display: center;
}

.tree-cell:expanded .tree-disclosure-node .arrow {
-fx-content-display: center;
-fx-background-color: #facf46,


-fx-rotate: 90;
}

.tree-cell:hover {
-fx-background-color: #dfffe7;
}

.tree-cell:selected{
-fx-background-color: #4f88da;
}

在这两个链接中,有我如何用 HBox 表示 TreCells 的代码:

Customizing TreeCells using cell factory JavaFX TreeView: setGraphic() for different levels of treeItem

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com