2017-06-02 13 views
1

私は50ラベルを追加したVBoxを持っています。それがScrollPane内にラップされていることを考えれば、データの残りを見るためにスクロールすることができますが、それは許されません。ScrollPaneはスクロールして内容を見ることができません

Scene Builderを使用してこれを構築しているので、XMLとして設定されています。

<?xml version="1.0" encoding="UTF-8"?> 

<?import javafx.scene.control.Label?> 
<?import javafx.scene.control.ScrollPane?> 
<?import javafx.scene.layout.*?> 
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="454.0" prefWidth="641.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.Controller"> 
    <children> 
     <VBox layoutX="111.0" layoutY="96.0" prefHeight="262.0" prefWidth="100.0"> 
     <children> 
      <Label contentDisplay="TOP" style="-fx-font-size: 20;" text="Stack" /> 
      <VBox fx:id="stackBox" alignment="BOTTOM_LEFT" prefHeight="284.0" prefWidth="149.0" style="-fx-border-color: black; -fx-background-color: lightgrey;" /> 
     </children> 
     </VBox> 
     <VBox layoutX="298.0" layoutY="47.0" prefHeight="379.0" prefWidth="198.0"> 
     <children> 
      <Label style="-fx-font-size: 20;" text="Heap" /> 
      <ScrollPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="341.0" prefWidth="202.0" vbarPolicy="ALWAYS"> 
       <content> 
       <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="200.0" prefWidth="200.0"> 
        <children> 
         <VBox fx:id="heapBox" prefHeight="284.0" prefWidth="149.0" style="-fx-border-color: black; -fx-background-color: lightgrey;" /> 
        </children> 
        </AnchorPane> 
       </content> 
      </ScrollPane> 
     </children> 
     </VBox> 
    </children> 
</AnchorPane> 

これは、それがどのように見える現在:VBoxの中に50個の要素があるので、私は残りの32個の要素を表示するには、スクロールダウンするために、それができるはず enter image description here

が、それができるよう見て、スクロールバーは許可しません。

この場合、何ができますか?

答えて

2

AnchorPaneScrollPaneの中からminprefのサイズの値を削除します。その後、あなたのAnchorPaneScrollPaneのコンテンツに収まるでしょう。

<AnchorPane> 
    <children> 
     <VBox fx:id="heapBox" prefHeight="284.0" prefWidth="149.0" style="-fx-border-color: black; -fx-background-color: lightgrey;" /> 
    </children> 
</AnchorPane> 
+0

ありがとうございました。 –

関連する問題