【发布时间】:2016-08-25 22:24:26
【问题描述】:
我有以下问题。我将这个 VBox 包裹在 AnchorPane 中:
<AnchorPane>
<children>
<VBox fx:id="sidebar" prefHeight="400.0" prefWidth="150.0" AnchorPane.bottomAnchor="0.0" AnchorPane.topAnchor="0.0"/>
</children>
</AnchorPane>
我想获得这个 vbox 的显示高度(即使在调整它周围的 Anchorpane 的大小之后。)
所以我尝试了以下方法:
double height = sidebar.getHeight();
但由于某种原因 getHeight() 只返回 0。所以...我如何获得该 vbox 的高度?
【问题讨论】: