如何在JavaFX中的Accordion中的TitledPanes之间添加填充 [英] How to add padding between TitledPanes in an Accordion in JavaFX

查看:958
本文介绍了如何在JavaFX中的Accordion中的TitledPanes之间添加填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在手风琴中的间距) TitledPane 手风琴)。



问题是,当扩展 TitledPane



TitledPane 未展开





一个 TittedPane 展开





我使用了以下CSS:



  .titled-pane {
-fx-skin:com.sun.javafx.scene.control.skin.TitledPaneSkin;
-fx-text-fill:-fx-text-base-color;
-fx-padding:0.5em;
}

一张图片显示了2 TitledPane 未展开,另一个图像显示第二个 TitledPane 后的感觉。

解决方案

这是一个错误(我创建了一个错误报告:


I would like to add padding between TitledPanes 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.

TitledPanes 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 TitledPanes 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 TitledPanes (rather than the top), the spacing between TitledPanes 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中的Accordion中的TitledPanes之间添加填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆