2015-02-10 128 views
0

我是新的javafx和fxml的東西,我無法實現將我的項目居中在我的邊框窗格中。如何將vbox大小設置爲最小(包裝內容)

我FXML如下:

<BorderPane ...> 
    <top> 
     <Label styleClass="page-title" text="%startup_title"> 
      <VBox.margin> 
       <Insets bottom="10.0" left="20.0" top="5.0" /> 
      </VBox.margin> 
     </Label> 
    </top> 
    <center> 
     <VBox fx:id="vbox" > 
     <children> 
      <ProgressBar fx:id="progressBar" prefWidth="500.0" progress="0.0" /> 
      <Label fx:id="progressLabel" styleClass="item-title" text="tt" /> 
     </children> 
     </VBox> 
    </center> 
</BorderPane> 

這個問題似乎是,VBOX有一個與整個屏幕,和裏面的物品都在TOP_LEFT。我知道我需要將vbox的寬度設置爲最小值,而不是讓它在邊界窗格中展開,但是如何?

謝謝!

+1

'對齊=「中心」' ? – fge 2015-02-10 10:41:16

+0

是的,謝謝,我想知道我是如何在場景製作中錯過的。 – Anthony 2015-02-10 10:44:25

回答

0

我找到了解決由於this post:只需添加對齊=「中心」的FXML ...

這是不是真的是我想要的,但這是不夠

相關問題