title: JavaFX tableview resize to fit window
body: <p>I am just trying out JavaFX and am forcing my way into it because it is suppose to be the future.  I am trying to create a table with 4 columns.  The columns AND THE TABLE should resize to fill the parent pane.  I cannot for the life of me get this to work.  I have been trying for over 4 hours now and the tableview does not resize.</p>
  
  <p>Here is my FXML file.</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;?import java.net.*?&gt;
  &lt;?import javafx.geometry.*?&gt;
  &lt;?import javafx.geometry.Insets?&gt;
  &lt;?import javafx.scene.control.*?&gt;
  &lt;?import javafx.scene.control.cell.*?&gt;
  &lt;?import javafx.scene.layout.*?&gt;
  &lt;?import javafx.scene.text.*?&gt;
  &lt;?import javafx.collections.*?&gt;
  &lt;?import t.cubed.fxml.*?&gt;
  
  
  &lt;BorderPane styleClass="root" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8" fx:controller="t.cubed.fxml.FXMLDocumentController"&gt;
      &lt;top&gt;
          &lt;MenuBar fx:id="menuBar" styleClass="menu-bar"&gt;
          &lt;menus&gt;
              &lt;Menu text="File"&gt;
                  &lt;items&gt;
                      &lt;MenuItem onAction="#handleOpenAction" text="Open" /&gt;
                      &lt;MenuItem onAction="#handleExitAction" text="Exit" /&gt;
                  &lt;/items&gt;
              &lt;/Menu&gt;
              &lt;Menu text="Edit"&gt;
                  &lt;items&gt;
                      &lt;MenuItem onAction="#handleWeightAction" text="Edit Weights" /&gt;  
                      &lt;MenuItem onAction="#handleFilterAction" text="Edit Filters" /&gt;
                      &lt;MenuItem onAction="#handleOptionsAction" text="Options" /&gt;
                  &lt;/items&gt;
              &lt;/Menu&gt;
          &lt;/menus&gt;
      &lt;/MenuBar&gt;
      &lt;/top&gt;
      &lt;center&gt;
          &lt;GridPane&gt;
                 &lt;!--
                 &lt;padding&gt;
                     &lt;Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/&gt; 
                 &lt;/padding&gt;
                 --&gt;
                 &lt;TableView fx:id="testTable" GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="1"&gt;
                     &lt;columnResizePolicy&gt;
                         &lt;TableView fx:constant="CONSTRAINED_RESIZE_POLICY" /&gt;
                     &lt;/columnResizePolicy&gt;
                     &lt;columns&gt;
                         &lt;TableColumn text="TEST NUMBER"&gt;
                         &lt;cellValueFactory&gt;
                             &lt;PropertyValueFactory property="testNumber" /&gt;
                         &lt;/cellValueFactory&gt;
                         &lt;/TableColumn&gt;
                         &lt;TableColumn text="TEST NAME"&gt;
                             &lt;cellValueFactory&gt;
                             &lt;PropertyValueFactory property="testName" /&gt;
                         &lt;/cellValueFactory&gt;
                         &lt;/TableColumn&gt;
                         &lt;TableColumn text="TEST TIME(ms)"&gt;
                             &lt;cellValueFactory&gt;
                             &lt;PropertyValueFactory property="testTime" /&gt;
                         &lt;/cellValueFactory&gt;
                         &lt;/TableColumn&gt;
                         &lt;TableColumn text="BEST MATCH"&gt;
                             &lt;cellValueFactory&gt;
                             &lt;PropertyValueFactory property="bestMatch" /&gt;
                         &lt;/cellValueFactory&gt;
                         &lt;/TableColumn&gt;
                     &lt;/columns&gt;
                     &lt;items&gt;
                      &lt;!--
                      &lt;FXCollections fx:factory="observableArrayList"&gt;
                          &lt;TestTableModel testNumber="100" testName="Test1234" testTime="0.34" bestMatch="99"/&gt;
                      &lt;/FXCollections&gt;
                      --&gt;
                  &lt;/items&gt;
                 &lt;/TableView&gt;
          &lt;/GridPane&gt;
      &lt;/center&gt;
  &lt;stylesheets&gt;
      &lt;URL value="@t-cubed.css" /&gt;
  &lt;/stylesheets&gt;
  &lt;/BorderPane&gt;
  </code></pre>