JavaFx: TextFlow в ScrollPane: AS_NEEDED Vbar не исчезает - PullRequest
0 голосов
/ 21 июня 2019

Я создаю графический интерфейс FX с AnchorPane в качестве пользователя root. У меня есть 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>
...