title: JavaFX: How to make my custom component use all available space from parent layout?
body: <p>I´m trying to make a custom component to javafx, so I make my class extends javafx.scene.control.Control and on constructor it draws it´s contents.</p>
  
  <p>My doubts are: how do I make it "grow" to fill all the space available on its parent layout? Like when I place a TextArea instead...</p>
  
  <p>This is an shrink example of what I´m doing:</p>
  
  <pre><code>@Override
  public void start(Stage primarystage) throws Exception {
      BorderPane bpane = new BorderPane();
      mainscene = new Scene(bpane, 800, 600);
      ((BorderPane) this.mainscene.getRoot()).setCenter(t);
  
      primarystage.setScene(mainscene);
      primarystage.show();
  }
  </code></pre>
  
  <p>On this example the TextArea will get all the space the layout provide for it. I want my component do the same!</p>
  
  <p>All I already tried to do:
  - Change the properties setMaxWidth/Height, setPrefWidth/Height, setMinWidth/Height; (when I set the MinValues, it always use this values to draw but don´t update the "width" value anymore)
  - Tried to use Double.MAX_VALUE to force a bigger size then layout privides;
  Everything didn´t work :( I must be mistaking somehow...
  - I cried a little too, but even this make nothing work ='(</p>
  
  <p>Maybe a clue is, I put a listener like this below, and everytime I resize my application/stage it updates the TextArea. But when I add this listener do my component it never get update...</p>
  
  <pre><code>TextArea t = new TextArea("teste");
  t.widthProperty().addListener(new ChangeListener() {
    public void changed(ObservableValue observable, Object oldValue, Object newValue) {
      System.out.println(oldValue + "|" + newValue);
    }
  });
  </code></pre>
  
  <p>Probably I´m passing by some properties or forgetting something, I don´t know...</p>
  
  <p>I already tried Google, but seems the documentation of JavaFX is too small and superficial, and a lot of them is based on JavaFX script...</p>
  
  <p>I also accepts any tutorial better them the one offered by Oracle...</p>
  
  <p>Thanks in advance of any help... I thing I wrote to much... =O</p>