title: JavaFX 11 fxml TableView Fails to Populate
body: <p>I have been endeavouring to implement a TableView using data generated in the initialize() method of the Controller and a user interface provide by the fxml.</p>
  <p>However, the TableView fails to poulate and displays an empty view with the message 'No content in table'.</p>
  <p>Consequently I have created a simplified application as follows.
  If anybody can suggest what I may have omitted it will be much appreciated.</p>
  <p>Controller</p>
  <pre><code>package sample;
  
  import javafx.beans.property.SimpleStringProperty;
  import javafx.collections.FXCollections;
  import javafx.collections.ObservableList;
  import javafx.fxml.FXML;
  import javafx.scene.control.TableColumn;
  import javafx.scene.control.TableView;
  import javafx.scene.control.cell.PropertyValueFactory;
  
  public class Controller {
  
      @FXML
      private TableView tvNicknames;
      @FXML
      private TableColumn tcName;
      @FXML
      private TableColumn tcNickname;
  
      @FXML
      public void initialize(){
          ObservableList&lt;DataModel&gt; nickList =
                  FXCollections.observableArrayList(
                          new DataModel(new SimpleStringProperty(&quot;Alan&quot;), new SimpleStringProperty(&quot;Pip&quot;)),
                          new DataModel(new SimpleStringProperty(&quot;Bertie&quot;), new SimpleStringProperty(&quot;Beets&quot;)),
                          new DataModel(new SimpleStringProperty(&quot;Charlie&quot;), new SimpleStringProperty(&quot;Collie&quot;)),
                          new DataModel(new SimpleStringProperty(&quot;Dave&quot;), new SimpleStringProperty(&quot;Daffy&quot;)),
                          new DataModel(new SimpleStringProperty(&quot;Ernie&quot;), new SimpleStringProperty(&quot;Einstein&quot;))
                  );
  
          //specify cell factories for each TableColumn
          tcName.setCellValueFactory(new PropertyValueFactory&lt;&gt;(&quot;name&quot;));
          tcNickname.setCellValueFactory(new PropertyValueFactory&lt;&gt;(&quot;nickname&quot;));
  
  
  
      }
  
  
  }
  
  </code></pre>
  <p>DataModel</p>
  <pre><code>package sample;
  
  import javafx.beans.property.SimpleStringProperty;
  
  public class DataModel {
  
      private SimpleStringProperty name;
      private SimpleStringProperty nickname;
  
      public DataModel() {
      }
  
      public DataModel(SimpleStringProperty name, SimpleStringProperty nickname) {
          this.name = name;
          this.nickname = nickname;
      }
  
      public String getName() {
          return name.get();
      }
  
      public SimpleStringProperty nameProperty() {
          return name;
      }
  
      public void setName(String name) {
          this.name.set(name);
      }
  
      public String getNickname() {
          return nickname.get();
      }
  
      public SimpleStringProperty nicknameProperty() {
          return nickname;
      }
  
      public void setNickname(String nickname) {
          this.nickname.set(nickname);
      }
  }
  </code></pre>
  <p>fxml</p>
  <pre><code>&lt;?import javafx.scene.control.*?&gt;
  &lt;?import javafx.scene.layout.FlowPane?&gt;
  &lt;FlowPane fx:controller=&quot;sample.Controller&quot;
            xmlns:fx=&quot;http://javafx.com/fxml&quot; alignment=&quot;center&quot; hgap=&quot;10&quot; vgap=&quot;10&quot;&gt;
  
      &lt;TableView fx:id=&quot;tvNicknames&quot; prefWidth=&quot;250&quot; prefHeight=&quot;200&quot;&gt;
          &lt;columns&gt;
              &lt;TableColumn fx:id=&quot;tcName&quot; text=&quot;Name&quot; prefWidth=&quot;100&quot;/&gt;
              &lt;TableColumn fx:id=&quot;tcNickname&quot; text=&quot;Nickname&quot; prefWidth=&quot;100&quot; /&gt;
          &lt;/columns&gt;
      &lt;/TableView&gt;
  
  &lt;/FlowPane&gt;
  </code></pre>