title: auto numbered table rows (javafx)
body: <p>My question is how to make a new Table in JavaFX with in the first column the index of the tableRow.</p>
  
  <p>So i've created a class: NrCellFactory.</p>
  
  <pre><code>public class NrCellFactory&lt;S, String&gt; extends TableCellFactory&lt;S,String&gt; {
  
  private class NrCell&lt;S,String&gt; extends TableCell&lt;S,String&gt;{
  
      public NrCell(){
          setText(this.getTableRow().getIndex()+"");
      }
  
  
  
  }
  
  @Override
  protected TableCell&lt;S, String&gt; createTableCell(TableColumn&lt;S, String&gt; column) {
      return new NrCell();
  }
  
  }
  </code></pre>
  
  <p>and then i set my column where the numbers should be displayed:</p>
  
  <pre><code> nrCol.setCellFactory(new NrCellFactory&lt;Person,String&gt;());
  </code></pre>
  
  <p>when I load the project, the nrCol has no data...</p>
  
  <p>Can anyone solve the problem?</p>
  
  <p>Thanks</p>