title: Center text in GridPane
body: <p>I am a beginner at Java and I have just recently started to take a look at GUI and JavaFX. And at the moment I am stuck trying to center a text inside a GridPane and would need som help with this, and an explaination to what I am doing wrong.</p>
  
  <p>This is my code:</p>
  
  <pre><code>GridPane grid = new GridPane();
  grid.setMinSize(100, 100);
  
  Text text = new Text("Hello World!");
  text.setTextAlignment(TextAlignment.CENTER);
  grid.add(text, 0, 1);
  grid.setStyle("-fx-background-color: #D8BFD8;");
  </code></pre>
  
  <p>This is not working (the text does not center), so I asume I am doing something wrong. But I cant understand what I am doing wrong?</p>