title: JavaFx, FXML, how to auto resize content: Button, StackPane, Field, Scrollpane according to their parents
body: <p>I am trying to design a Java application using Fxml (SceneBuilder), the problem I am facing right now is that, I am not able to auto resize contents, ScrollPane according to GridPane (1,2) row 1, StackPane according to GridPane row 2 and Button and Textfield according to pane.
  Is there any property which can help me or any alternative solution?</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import javafx.scene.control.Button?&gt;
  &lt;?import javafx.scene.control.Label?&gt;
  &lt;?import javafx.scene.control.ScrollPane?&gt;
  &lt;?import javafx.scene.control.TableColumn?&gt;
  &lt;?import javafx.scene.control.TableView?&gt;
  &lt;?import javafx.scene.control.TextField?&gt;
  &lt;?import javafx.scene.layout.AnchorPane?&gt;
  &lt;?import javafx.scene.layout.ColumnConstraints?&gt;
  &lt;?import javafx.scene.layout.GridPane?&gt;
  &lt;?import javafx.scene.layout.Pane?&gt;
  &lt;?import javafx.scene.layout.RowConstraints?&gt;
  &lt;?import javafx.scene.layout.StackPane?&gt;
  
  &lt;AnchorPane id="ClientItemMainAnchorPane" fx:id="ClientItem_anchorPane1" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1"&gt;
     &lt;children&gt;
        &lt;StackPane fx:id="ClientItem_stackPane1" prefHeight="600.0" prefWidth="800.0" AnchorPane.topAnchor="0.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"&gt;
           &lt;children&gt;
              &lt;GridPane fx:id="ClientItem_gridPane" &gt;
                &lt;columnConstraints&gt;
                  &lt;ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /&gt;
                &lt;/columnConstraints&gt;
                &lt;rowConstraints&gt;
                  &lt;RowConstraints maxHeight="517.0" minHeight="10.0" prefHeight="435.0" vgrow="SOMETIMES" /&gt;
                  &lt;RowConstraints maxHeight="294.0" minHeight="10.0" prefHeight="165.0" vgrow="SOMETIMES" /&gt;
                &lt;/rowConstraints&gt;
                 &lt;children&gt;
                    &lt;ScrollPane fx:id="ClientItem_scrollPane" prefHeight="417.0" prefWidth="800.0"&gt;
                       &lt;content&gt;
                          &lt;AnchorPane fx:id="ClientItem_AnchorPane2" prefHeight="396.0" prefWidth="736.0"&gt;
                             &lt;children&gt;
                                &lt;TableView fx:id="ClientItem_tableView" layoutX="14.0" layoutY="14.0" prefHeight="382.0" prefWidth="768.0"&gt;
                                  &lt;columns&gt;
                                    &lt;TableColumn fx:id="ClientItem_tableCol_ClientNo" prefWidth="66.0" text="Client No." /&gt;
                                    &lt;TableColumn fx:id="ClientItem_tableCol_Name" prefWidth="188.0" text="Name" /&gt;
                                      &lt;TableColumn fx:id="ClientItem_tableCol_Address" minWidth="0.0" prefWidth="220.0" text="Address" /&gt;
                                      &lt;TableColumn fx:id="ClientItem_tableCol_Phone" minWidth="0.0" prefWidth="108.0" text="Phone" /&gt;
                                      &lt;TableColumn fx:id="ClientItem_tableCol_Remaing" minWidth="0.0" prefWidth="95.0" text="Remaining" /&gt;
                                      &lt;TableColumn fx:id="ClientItem_tableCol_Type" prefWidth="87.0" text="Type" /&gt;
                                  &lt;/columns&gt;
                                &lt;/TableView&gt;
                             &lt;/children&gt;
                          &lt;/AnchorPane&gt;
                       &lt;/content&gt;
                    &lt;/ScrollPane&gt;
                    &lt;StackPane fx:id="ClientItem_StackPane2" prefHeight="150.0" prefWidth="200.0" GridPane.rowIndex="1"&gt;
                       &lt;children&gt;
                          &lt;Pane fx:id="ClientItem_Pane" prefHeight="200.0" prefWidth="200.0"&gt;
                             &lt;children&gt;
                                &lt;TextField fx:id="ClientItem_textField_ClientNo" layoutX="14.0" layoutY="42.0" prefHeight="25.0" prefWidth="69.0" /&gt;
                                &lt;TextField fx:id="ClientItem_textField_Name" layoutX="80.0" layoutY="42.0" prefHeight="25.0" prefWidth="188.0" /&gt;
                                &lt;TextField fx:id="ClientItem_textField_Remaining" layoutX="596.0" layoutY="42.0" prefHeight="25.0" prefWidth="95.0" /&gt;
                                &lt;TextField fx:id="ClientItem_textField_Type" layoutX="691.0" layoutY="42.0" prefHeight="25.0" prefWidth="87.0" /&gt;
                                &lt;TextField fx:id="ClientItem_textField_Address" layoutX="268.0" layoutY="42.0" prefHeight="25.0" prefWidth="220.0" /&gt;
                                &lt;TextField fx:id="ClientItem_textField_Phone" layoutX="488.0" layoutY="42.0" prefHeight="25.0" prefWidth="108.0" /&gt;
                                &lt;Label alignment="CENTER" layoutX="22.0" layoutY="14.0" text="Client No." /&gt;
                                &lt;Label alignment="CENTER" contentDisplay="TOP" layoutX="158.0" layoutY="14.0" text="Name" /&gt;
                                &lt;Label alignment="CENTER" layoutX="357.0" layoutY="14.0" text="Address" /&gt;
                                &lt;Label alignment="CENTER" layoutX="525.0" layoutY="14.0" text="Phone" /&gt;
                                &lt;Label alignment="CENTER" layoutX="615.0" layoutY="14.0" text="Remaining" /&gt;
                                &lt;Label alignment="CENTER" layoutX="722.0" layoutY="14.0" text="Type" /&gt;
                                &lt;Button fx:id="ClientItem_btn_Add" layoutX="307.0" layoutY="84.0" mnemonicParsing="false" prefHeight="50.0" prefWidth="100.0" text="Add" /&gt;
                                &lt;Button fx:id="ClientItem_btn_Delete" layoutX="425.0" layoutY="84.0" mnemonicParsing="false" prefHeight="50.0" prefWidth="100.0" text="Delete" /&gt;
                             &lt;/children&gt;
                          &lt;/Pane&gt;
                       &lt;/children&gt;
                    &lt;/StackPane&gt;
                 &lt;/children&gt;
              &lt;/GridPane&gt;
           &lt;/children&gt;
        &lt;/StackPane&gt;
     &lt;/children&gt;
  &lt;/AnchorPane&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/SDkeq.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SDkeq.jpg" alt="enter image description here"></a></p>