我正在设计一个以AnchorPane
为根的FX GUI。我有一个TextFlow
来显示包装在ScrollPane
中的格式化文本,以获取滚动条。 hbar策略被设置为NEVER
,没有滚动条。很好。
vbar策略为AS_NEEDED
,但即使文本流为空,也始终显示vbar。
<ScrollPane fx:id="scrollPaneForLog" fitToWidth="true" hbarPolicy="NEVER" vbarPolicy="AS_NEEDED" layoutX="394.0" layoutY="16.0" prefViewportHeight="490.0" prefViewportWidth="380.0" AnchorPane.bottomAnchor="48.0" AnchorPane.leftAnchor="394.0" AnchorPane.rightAnchor="16.0" AnchorPane.topAnchor="16.0">
<content>
<TextFlow fx:id="txtLogArea" layoutX="395.0" layoutY="14.0" style="-fx-background-color: white;" AnchorPane.bottomAnchor="50.0" AnchorPane.leftAnchor="394.0" AnchorPane.rightAnchor="16.0" AnchorPane.topAnchor="16.0">
<padding>
<Insets bottom="16.0" left="16.0" right="16.0" top="16.0" />
</padding>
</TextFlow>
</content>
</ScrollPane>