title: Can't populate JavaFX TableView created in SceneBuilder 2
body: <p>I am trying to re-create the <a href="http://docs.oracle.com/javafx/2/ui_controls/table-view.htm" rel="nofollow noreferrer">table view sample</a> using scene builder 2, but my TableView couldn’t be populated.</p>
  
  <p>I defined my table in JavaFx SceneBuilder like so:</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;AnchorPane id="AnchorPane" prefHeight="380.0" prefWidth="462.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8" fx:controller="tableviewsample.FXMLDocumentController"&gt;
      &lt;children&gt;
          &lt;Button fx:id="button" layoutX="325.0" layoutY="324.0" onAction="#handleButtonAction" text="Click Me!" /&gt;
          &lt;Label fx:id="label" layoutX="126" layoutY="120" minHeight="16" minWidth="69" /&gt;
          &lt;TableView fx:id="table" layoutX="26.0" layoutY="29.0" prefHeight="221.0" prefWidth="411.0"&gt;
              &lt;columns&gt;
                  &lt;TableColumn fx:id="firstNameCol" prefWidth="75.0" text="First Name" /&gt;
                  &lt;TableColumn fx:id="lastNameCol" prefWidth="75.0" text="Last Name" /&gt;
                  &lt;TableColumn fx:id="emailCol" prefWidth="75.0" text="Email" /&gt;
              &lt;/columns&gt;
          &lt;/TableView&gt;
          &lt;TextField fx:id="addFirstName" layoutX="26.0" layoutY="284.0" prefHeight="25.0" prefWidth="81.0" promptText="First Name" /&gt;
          &lt;TextField fx:id="addLastName" layoutX="121.0" layoutY="284.0" prefHeight="25.0" prefWidth="89.0" promptText="Last Name" /&gt;
          &lt;TextField fx:id="addEmail" layoutX="222.0" layoutY="284.0" promptText="Email" /&gt;
      &lt;/children&gt;
  &lt;/AnchorPane&gt;
  </code></pre>
  
  <p>My controller code:</p>
  
  <pre><code>package tableviewsample;
  
  import java.net.URL;
  import java.util.ResourceBundle;
  import javafx.beans.property.SimpleStringProperty;
  import javafx.collections.FXCollections;
  import javafx.collections.ObservableList;
  import javafx.event.ActionEvent;
  import javafx.fxml.FXML;
  import javafx.fxml.Initializable;
  import javafx.scene.control.Label;
  import javafx.scene.control.TableColumn;
  import javafx.scene.control.TableView;
  import javafx.scene.control.TextField;
  
  public class FXMLDocumentController implements Initializable {
  
      @FXML
      private Label label;
  
      @FXML
      private TableView&lt;Person&gt; table;// = new TableView&lt;Person&gt;();
  
      @FXML private TableColumn firstNameCol ;
      @FXML private TableColumn lastNameCol ;
      @FXML private TableColumn emailCol ;
  
      @FXML TextField addFirstName;
      @FXML TextField addLastName;
      @FXML TextField addEmail;
  
      private final ObservableList&lt;Person&gt; data
              = FXCollections.observableArrayList(
                      new Person("Jacob", "Smith", "jacob.smith@example.com"),
                      new Person("Isabella", "Johnson", "isabella.johnson@example.com"),
                      new Person("Ethan", "Williams", "ethan.williams@example.com"),
                      new Person("Emma", "Jones", "emma.jones@example.com"),
                      new Person("Michael", "Brown", "michael.brown@example.com")
              );
  
      @FXML
      private void handleButtonAction(ActionEvent event) {
          System.out.println("You clicked me!");
          data.add(new Person(
                  addFirstName.getText(),
                  addLastName.getText(),
                  addEmail.getText()));
          addFirstName.clear();
          addLastName.clear();
          addEmail.clear();
      }
  
      @Override
      public void initialize(URL url, ResourceBundle rb) {
          // TODO
          firstNameCol.setMinWidth(100);
          lastNameCol.setMinWidth(100);
          emailCol.setMinWidth(200);
          table.getItems().setAll(this.data);
      }
  
      public static class Person {
  
          private final SimpleStringProperty firstName;
          private final SimpleStringProperty lastName;
          private final SimpleStringProperty email;
  
          private Person(String fName, String lName, String email) {
              this.firstName = new SimpleStringProperty(fName);
              this.lastName = new SimpleStringProperty(lName);
              this.email = new SimpleStringProperty(email);
          }
  
          public String getFirstName() {
              return firstName.get();
          }
  
          public void setFirstName(String fName) {
              firstName.set(fName);
          }
  
          public String getLastName() {
              return lastName.get();
          }
  
          public void setLastName(String fName) {
              lastName.set(fName);
          }
  
          public String getEmail() {
              return email.get();
          }
  
          public void setEmail(String fName) {
              email.set(fName);
          }
      }
  }
  </code></pre>
  
  <p>The main code:</p>
  
  <pre><code>package tableviewsample;
  
  import javafx.application.Application;
  import javafx.fxml.FXMLLoader;
  import javafx.scene.Parent;
  import javafx.scene.Scene;
  import javafx.stage.Stage;
  
  public class TableViewSample extends Application {
  
      @Override
      public void start(Stage stage) throws Exception {
          Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
          Scene scene = new Scene(root);
          stage.setScene(scene);
          stage.show();
      }
  
      public static void main(String[] args) {
          launch(args);
      }
  }
  </code></pre>
  
  <p>Screenshot:</p>
  
  <p><img src="https://i.stack.imgur.com/ijzBV.jpg" alt="screenshot"></p>
  
  <p>When I run it, there are empty rows in the table. If I type some values in the 3 TextFields and click the button, still the values are not inserted in the table. 
  Can you please find what's wrong with the code? Also, on an unrelated note, how can I make the table scrollable?</p>