title: JavaFX using a custom listcell
body: <p>I have trying to figure out how to use a <code>CustomListCell</code> with a <code>ListView</code> in <code>JavaFX</code> but no luck, I have looked up and all I can find are incomplete tutorials and questions. Below is my <code>CustomListCell</code> FXML</p>
  
  <pre><code>  &lt;AnchorPane id="AnchorPane" styleClass="backPane" 
         stylesheets="@../css/mainwindow.css" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1"&gt;
    &lt;children&gt;
    &lt;HBox alignment="CENTER_LEFT" styleClass="backPane"&gt;
       &lt;children&gt;
          &lt;HBox styleClass="card" HBox.hgrow="ALWAYS"&gt;
             &lt;children&gt;
                &lt;ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true"&gt;
                   &lt;image&gt;
                      &lt;Image url="@../images/picture_placeholder.png" /&gt;
                   &lt;/image&gt;
                &lt;/ImageView&gt;
                &lt;VBox HBox.hgrow="ALWAYS"&gt;
                   &lt;children&gt;
                      &lt;Label fx:id="lbTitle" styleClass="fixture-title" stylesheets="@../css/mainwindow.css" text=" Livingston 19:45 Falkirk" /&gt;
                      &lt;Label fx:id="lbDescription" styleClass="fixture-description" text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin at turpis nisl. Interdum et malesuada fames ac ante ipsum primis in faucibus. Vestibulum laoreet elementum velit. Curabitur tincidunt finibus malesuada. Aliquam dapibus semper scelerisque. Sed tristique tellus eget sem ornare cursus." /&gt;
                   &lt;/children&gt;&lt;/VBox&gt;
             &lt;/children&gt;
             &lt;HBox.margin&gt;
                &lt;Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /&gt;
             &lt;/HBox.margin&gt;
          &lt;/HBox&gt;
         &lt;/children&gt;
        &lt;/HBox&gt;
        &lt;/children&gt;
      &lt;/AnchorPane&gt;
  </code></pre>
  
  <p>And my model</p>
  
  <pre><code>public class Ticket {
  
  
  private long id;
  private String imageUrl;
  private String title;
  private String description;
  
  public Ticket(long id, String imageUrl, String title, String description) {
      this.id = id;
      this.imageUrl = imageUrl;
      this.title = title;
      this.description = description;
  }
  
  public long getId() {
      return id;
  }
  
  public void setId(long id) {
      this.id = id;
  }
  
  public String getImageUrl() {
      return imageUrl;
  }
  
  public void setImageUrl(String imageUrl) {
      this.imageUrl = imageUrl;
  }
  
  public String getTitle() {
      return title;
  }
  
  public void setTitle(String title) {
      this.title = title;
  }
  
  public String getDescription() {
      return description;
  }
  
  public void setDescription(String description) {
      this.description = description;
  }
  
  }
  </code></pre>
  
  <p>And my incomplete <code>CustomListCell</code></p>
  
  <pre><code>public class TicketCell &lt;Ticket&gt; extends ListCell&lt;Ticket&gt; { 
  
  private final TicketCellController ticketCellController = new TicketCellController();
  private final Node view = ticketCellController.getView();
  
  @Override
  protected void updateItem(Ticket item, boolean empty) {
      super.updateItem(item, empty);
      if (empty) {
          setGraphic(null);
      } else {
          ticketCellController.setTicket(item);
          setGraphic(view);
      }
  } 
  }
  </code></pre>
  
  <p>And my controller</p>
  
  <pre><code>public class TicketCellController implements Initializable{
  
  private static final String TAG = MainWindowController.class.getSimpleName();
  private Logger logger;
  private Ticket ticket;
  @FXML
  private Label lbTitle;
  @FXML
  private Label lbDescription;
  @FXML
  private AnchorPane anchorPane;
  
  
  
  @Override
  public void initialize(URL url, ResourceBundle rb) {
    logger = Logger.getLogger(MainWindowController.class);
      BasicConfigurator.configure();  
  } 
  </code></pre>
  
  <p>Please not that <code>ticketCellController.getView()</code> is not being found. Am lost at this point, I donnot know the right way of updating the imageview and labels on in my <code>CustomListCell</code> FXML. Anyone to help or with a link to a tutorial I can follow, I will appreciate.</p>