我创建了一个.fxml文件,其中添加了一些TitledPane,但不能在应用程序中调整它们的大小。以下是代码:
<ScrollPane AnchorPane.topAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.bottomAnchor="0.0"
AnchorPane.leftAnchor="0.0">
<SplitPane orientation="VERTICAL" fx:id="splitPane">
<TitledPane>
<TextArea fx:id="taTop" wrapText="true" editable="false" prefHeight="100"/>
</TitledPane>
<TitledPane>
<TableView fx:id="tableFrist" minHeight="120" maxHeight="120">
<columns>
<TableColumn fx:id="column" prefWidth="200"/>
</columns>
</TableView>
</TitledPane>
<TitledPane>
<TreeTableView fx:id="tableSecond">
<columns>
<TreeTableColumn fx:id="columnTreeS" prefWidth="200"/>
</columns>
</TreeTableView>
</TitledPane>
<TitledPane>
<TreeTableView fx:id="tableThird">
<columns>
<TreeTableColumn fx:id="columnTreeT" prefWidth="200"/>
</columns>
</TreeTableView>
</TitledPane>
<TitledPane>
<TextArea fx:id="taBot" wrapText="true" editable="false"/>
</TitledPane>
</SplitPane>
</ScrollPane>我错过了什么,或者为什么我不能调整玻璃的大小?
发布于 2017-06-02 13:29:36
将fitToHeight和fitToWidth属性设置为ScrollPane的true:
https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/ScrollPane.html#fitToHeightProperty
如果为true,并且所包含的节点是可调整大小的,则将调整节点的大小以与ScrollPane的视图端口的高度相匹配。如果包含的节点不可调整大小,则忽略此值。
变化
<ScrollPane AnchorPane.topAnchor="0.0"
AnchorPane.rightAnchor="0.0"
AnchorPane.bottomAnchor="0.0"
AnchorPane.leftAnchor="0.0">至
<ScrollPane AnchorPane.topAnchor="0.0"
AnchorPane.rightAnchor="0.0"
AnchorPane.bottomAnchor="0.0"
AnchorPane.leftAnchor="0.0"
fitToHeight="true"
fitToWidth="true">https://stackoverflow.com/questions/44329829
复制相似问题