title: JavaFX 8 Custom ListView Cells it's Evil
body: <p>I have custom ListView cell i have HBox with two controls:</p>
  
  <ol>
  <li>Label with name field</li>
  <li>It's must generated from context of object</li>
  </ol>
  
  <p>For example i set ListView items array of Class Fields, if field type Boolean i create CheckBox, if String i create TextField and etc.</p>
  
  <p>Problem is: i get Field object only in method updateItem() - and only there i can create my controls.</p>
  
  <p>In JavaFX 7 all works fine, but on Java 8  - i dont see my controls.</p>
  
  <p>Is exists correct way to resolve my case?</p>
  
  <p><strong>UPDATE 1</strong></p>
  
  <p>Here complete example for replicate problem:</p>
  
  <pre><code>package javafx8listviewexample;
  
  import java.lang.reflect.Field;
  import java.net.URL;
  import java.util.Date;
  import java.util.ResourceBundle;
  import javafx.collections.FXCollections;
  import javafx.event.ActionEvent;
  import javafx.fxml.FXML;
  import javafx.fxml.Initializable;
  import javafx.scene.control.DatePicker;
  import javafx.scene.control.ListCell;
  import javafx.scene.control.ListView;
  import javafx.scene.control.TextField;
  import javafx.scene.control.cell.TextFieldListCell;
  import javafx.util.Callback;
  
  /**
   *
   * @author dmitrynelepov
   */
  public class FXMLDocumentController implements Initializable {
  
      static class TestClassForListView {
  
          public String fieldString;
          public Date fieldDate;
      }
  
      static class MyListCell extends ListCell&lt;Field&gt; {
  
          /**
           * As in tutorial
           *
           * @param t
           * @param bln
           */
          @Override
          protected void updateItem(Field t, boolean bln) {
              super.updateItem(t, bln);
              if (t != null) {
                  if (t.getType().equals(String.class)) {
                      System.out.println("Draw string");
                      setGraphic(new TextField(t.getName()));
                  } else if (t.getType().equals(Date.class)) {
                      System.out.println("Draw Date");
                      setGraphic(new DatePicker());
  
                  }
              }
          }
  
      }
  
      @FXML
      private ListView&lt;Field&gt; listView;
  
      @FXML
      private void handleButtonAction(ActionEvent event) {
          this.listView.getItems().clear();
          this.listView.setItems(
                  FXCollections.observableArrayList(
                          TestClassForListView.class.getFields()
                  )
          );
      }
  
      @Override
      public void initialize(URL url, ResourceBundle rb) {
          this.listView.setCellFactory(new Callback&lt;ListView&lt;Field&gt;, ListCell&lt;Field&gt;&gt;() {
  
              @Override
              public ListCell&lt;Field&gt; call(ListView&lt;Field&gt; p) {
                  return new MyListCell();
              }
          });
  
      }
  
  }
  </code></pre>
  
  <p>Here screenshot of program JDK 7</p>
  
  <p><img src="https://i.stack.imgur.com/nELF5.png" alt="enter image description here"></p>
  
  <p>as u can see i TextField can be focused and edited.</p>
  
  <p>But if i run this example with JDK 8 i got</p>
  
  <p><img src="https://i.stack.imgur.com/uiFm6.png" alt="enter image description here"></p>
  
  <p>as here u can see TextField cant be focused and edited.</p>