title: Fixed cell size table with Java-FX
body: <p>I've been fighting with this for some time, and finally figured I needed some help. </p>
  
  <p>I am trying to create a table where each cell displays a particular color. This is dynamically created based on a user selected image. </p>
  
  <p>I got it to work with a TilePane, but because of the size of the table, it was running extremely slow. </p>
  
  <p>Currently, I am trying to make it work using a TableView. The TableView is being created, but not populated. My code to create the TableView, and my custom TableCell class, is below. </p>
  
  <p>My main question is this: Is this the best way to go about this? If so, what am I doing wrong? </p>
  
  <p>Thank you in advance for the awesome assistance I always see here. </p>
  
  <p>Code to create TableView:</p>
  
  <pre><code>private ObservableList&lt;ObservableList&lt;Stitch&gt;&gt; stitchList;
  private TableView&lt;Stitch&gt; pattern;
  
  @Override
  protected TableView&lt;Stitch&gt; call() throws Exception {
      for (int i=0; i&lt; stitchList.size(); i++) {
          TableColumn&lt;Stitch, Color&gt; column = new TableColumn&lt;&gt;();
          column.setCellValueFactory(new Callback&lt;CellDataFeatures&lt;Stitch, Color&gt;, ObservableValue&lt;Color&gt;&gt;() {
  
               public ObservableValue&lt;Color&gt; call(CellDataFeatures&lt;Stitch, Color&gt; stitch) {
                   return stitch.getValue().getDisplayColorProperty();
               }
               });
  
          column.setCellFactory(new Callback&lt;TableColumn&lt;Stitch, Color&gt;, TableCell&lt;Stitch, Color&gt;&gt;() {
               @Override public TableCell&lt;Stitch, Color&gt; call(TableColumn&lt;Stitch, Color&gt; list) {
                   return new StitchCell();
               }
           });
  
          //Set column sizes
          column.setMinWidth(10);
          column.setMaxWidth(10);
          pattern.getColumns().add(column);
      }
  
      return pattern;
  } // End Call
  </code></pre>
  
  <p>Code for custom cell class</p>
  
  <pre><code>public class StitchCell extends TableCell&lt;Stitch, Color&gt; {
  
  @Override 
  protected void updateItem(Color color, boolean empty) {
      super.updateItem(color, empty);
  
      if (empty || color == null) {
          this.setStyle("-fx-background-color: white");
      } else {
          this.setStyle("-fx-background-color: #" + Integer.toHexString(color.hashCode()));
      }
  }
  }
  </code></pre>