title: Binding BorderPane and Frame Height and Width
body: <p>I am using JavaFX 2 in Netbeans. How do I get the width and height of an element to adjust when the Frame is resized? Here is my layout:</p>
  
  <pre><code>Stage stage = new Stage();
  stage.setTitle("Hello World");
  final Group root = new Group();
  Scene scene = new Scene(root);
  
  BorderPane border = new BorderPane();
  border.setPrefWidth(stage.getWidth());
  border.setPrefHeight(stage.getHeight());
  
  HBox outerHBox = new HBox();
  border.setCenter(outerHBox);
  root.getChildren().add(border);
  stage.setScene(scene);
  </code></pre>
  
  <p><strong>After some more research</strong>
  I found where this has been done before <a href="http://java.dzone.com/articles/setting-stage-javafx-sdk" rel="nofollow">http://java.dzone.com/articles/setting-stage-javafx-sdk</a> but it is in an older FX (very different from JavaFX 2). I am having trouble translating it. Looks like I should be using binding? I've never used binding before and I've barely used FX.</p>
  
  <p>Whats the best way to accomplish this?</p>