title: JavaFX - TabPane/Tab How to add content which fills the tab in size?
body: <p><br>
  I am playing with JavaFX and i have a small problem, which i cannot solve.<br>
  I want to add a new Tab (from FXML) to a existing TabPane.</p>
  
  <p>This is my code:</p>
  
  <pre><code>try
  {
     URL location = WPClientController.class.getResource("WPClient.fxml"); 
     FXMLLoader fxmlLoader = new FXMLLoader();
     fxmlLoader.setLocation(location);
     fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
     Node node = (Node) fxmlLoader.load(location.openStream());
  
     Tab newTab = new Tab("engel", node);
     fxTabWP.getTabs().add(newTab);
  }
  catch (Exception exception)
  {
    //no real error handling...just print the stacktrace... 
    exception.printStackTrace();
  }
  </code></pre>
  
  <p>this code will result in:</p>
  
  <p><img src="https://i.stack.imgur.com/wNmIg.png" alt="enter image description here"></p>
  
  <p>The code works, but (as seen on the screenshot) the added node (a SplitPane here) uses it's preferred size (on TabPage, which is wrong for me).<br>
  The size of the added SplitPane should have the same size as it's parent container. (and it should grow and shrink, when the parent container grows or shrinks) (like BorderLayout in Swing)</p>
  
  <p>EDIT (here is [now the correct] content of the TAB FXML):</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import java.lang.*?&gt;
  &lt;?import java.util.*?&gt;
  &lt;?import javafx.scene.*?&gt;
  &lt;?import javafx.scene.control.*?&gt;
  &lt;?import javafx.scene.layout.*?&gt;
  
  &lt;VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.test.ui.fx.client.ClientController"&gt;
   &lt;children&gt;
    &lt;HBox prefHeight="100.0" prefWidth="200.0" VBox.vgrow="ALWAYS"&gt;
       &lt;children&gt;
          &lt;SplitPane dividerPositions="0.29797979797979796" prefHeight="160.0" prefWidth="200.0" HBox.hgrow="ALWAYS"&gt;
            &lt;items&gt;
                &lt;HBox prefHeight="100.0" prefWidth="200.0"&gt;
                   &lt;children&gt;
                      &lt;TreeView fx:id="fxTreeView" prefHeight="200.0" prefWidth="200.0" HBox.hgrow="ALWAYS" /&gt;
                   &lt;/children&gt;
                &lt;/HBox&gt;
                &lt;HBox fx:id="fxTreeNodeContentBox" prefHeight="100.0" prefWidth="200.0" /&gt;
            &lt;/items&gt;
          &lt;/SplitPane&gt;
       &lt;/children&gt;
      &lt;/HBox&gt;
   &lt;/children&gt;
  &lt;/VBox&gt;
  </code></pre>
  
  <p><b>My question:</b> What is todo, so the SplitPane's size will dynamically fit it's parent container size?</p>