因为我需要一次有多个可折叠的TitledPanes(默认的JavaFX Accordion不支持),所以我在VBox中添加了一些TitledPanes。到目前为止,这工作正常,但我意识到TitledPanes的宽度比实际的VBox的宽度小10px。带有标题栏的VBox的JavaFX填充
继FXML代码:
<Pane prefHeight="700.0" prefWidth="1000.0" xmlns="http://javafx.com/javafx/8.0.71" xmlns:fx="http://javafx.com/fxml/1">
<children>
<VBox prefHeight="700.0" prefWidth="1000.0">
<children>
<TitledPane animated="false" text="Pane 1">
<content>
<AnchorPane prefHeight="300.0" />
</content>
</TitledPane>
<TitledPane animated="false" text="Pane 2">
<content>
<AnchorPane prefHeight="300.0" />
</content>
</TitledPane>
</children>
</VBox>
</children>
</Pane>
该css代码:
VBox {
-fx-padding: 0 -11 0 -1;
}
对我来说,这个解决方案工作正常,但它看起来像一个糟糕的解决方法。我想那里需要更聪明的解决方案?!
感谢很多提前:)
谢谢,原来如此! ;-) – pixelstuermer