title: JavaFX 8 - Positioning Text Vertical Center of HBox
body: <p>I am having a very difficult time positioning Text in an HBox. I am able to set the Horizontal Alignment of the Text, but I am not able to set the Vertical Alignment of the Text. I am trying to set the Text in the Vertical Center of the Hbox, however it is appearing at the top.</p>
  
  <p>Any help would be much appreciated.</p>
  
  <pre><code>// Create The Updates Progress Bar At The Bottom Of The Window
  HBox checkUpdatesBar = new HBox();
  checkUpdatesBar.setId("checkUpdatesBar");
  checkUpdatesBar.setPrefSize(CHECK_PANE_WIDTH, CHECK_PANE_HEIGHT);
  checkUpdatesBar.setMinSize(CHECK_PANE_WIDTH, CHECK_PANE_HEIGHT);
  checkUpdatesBar.setMaxSize(CHECK_PANE_WIDTH, CHECK_PANE_HEIGHT);
  
  // Create The 'Check For Updates...' Text
  Text checkForUpdates = new Text();
  checkForUpdates.setFont(Font.font("Arial Black", FontWeight.BLACK, 15));
  checkForUpdates.setWrappingWidth(CHECK_PANE_WIDTH / 2.8);
  checkForUpdates.setFill(Color.WHITE);
  checkForUpdates.setTextAlignment(TextAlignment.CENTER);
  checkForUpdates.setText("Checking For Updates ...".toUpperCase());
  
  checkUpdatesBar.getChildren().add(checkForUpdates);
  </code></pre>
  
  <p>My code produces the following: <a href="http://puu.sh/ccEkp/41a26038a4.png" rel="noreferrer">http://puu.sh/ccEkp/41a26038a4.png</a></p>
  
  <p>I like my Horizontal Positioning. I know its not in the middle because I set it to be that way. However, I just care about the <strong>Vertical Positioning</strong>.</p>
  
  <p>I have tried the following separately:</p>
  
  <pre><code>checkForUpdates.setLayoutY(20);
  checkForUpdates.setY(20);
  </code></pre>
  
  <p>I chose the number 20 because I wanted to move the Text 20 pixels down from the top of the HBox. I calculated this value in Photoshop. Though if there is a better way for setting the Text to the Vertical Center of the HBox, please do enlighten me.</p>
  
  <p>Thanks again for all the help!</p>