如何在 JavaFX 的手风琴中的 TitledPanes 之间添加填充 [英] How to add padding between TitledPanes in an Accordion in JavaFX
问题描述
我想在 Accordion
中的 TitledPane
之间添加填充(Accordion
中的间距).
问题在于,当一个 TitledPane
被展开时,下一个 TitledPane
的外观和感觉会被破坏.
TitledPane
未展开
一个 TitledPane
展开
我使用了以下 CSS:
.titled-pane {-fx-skin: "com.sun.javafx.scene.control.skin.TitledPaneSkin";-fx-text-fill: -fx-text-base-color;-fx 填充:0.5em;}
一张图显示了两个 TitledPane
未展开时的分离,另一张图显示了打开第一个 TitledPane
后第二个 TitledPane
的外观.
这是一个错误(我创建了一个错误报告:
I would like to add padding between TitledPane
s in an Accordion
(spacing in Accordion
).
The problem is that, when a TitledPane
is expanded, the look and feel of the next TitledPane
is broken.
TitledPane
s unexpanded
One TitledPane
expanded
I have used the following CSS:
.titled-pane {
-fx-skin: "com.sun.javafx.scene.control.skin.TitledPaneSkin";
-fx-text-fill: -fx-text-base-color;
-fx-padding: 0.5em;
}
One image show the separation between 2 TitledPane
s unexpanded, and another image show the look an feel of the second TitledPane
after open the first one.
It's a bug (I've created a bug report: JDK-8162599).
As a workaround, if you specify only the bottom padding of TitledPane
s (rather than the top), the spacing between TitledPane
s in the Accordion
is correct.
CSS to add bottom padding
.accordion > .titled-pane {
-fx-padding: 0 0 0.5em 0;
}
An example Accordion
looks like this:
这篇关于如何在 JavaFX 的手风琴中的 TitledPanes 之间添加填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!