title: JavaFX Editable ComboBox : Showing toString on item selection
body: <p>I have a <code>ComboBox&lt;Person&gt;</code>, of type <code>Person</code>, in which I have added few object of <code>Person</code> class.</p>
  <p>I have used <code>setCellFactory(Callback)</code> method to show <code>Person</code> name in <code>ComboBox</code> drop down</p>
  <pre><code>combobox.setCellFactory(
      new Callback&lt;ListView&lt;Person &gt;, ListCell&lt;Person &gt;&gt;() {
          @Override
          public ListCell&lt;Person &gt; call(ListView&lt;Person &gt; p) {
              ListCell cell = new ListCell&lt;Person &gt;() {
                  @Override
                  protected void updateItem(Person item, boolean empty) {
                      super.updateItem(item, empty);
                      if (empty) {
                          setText(&quot;&quot;);
                      } else {
                          setText(item.getName());
                      }
                  }
              };
              return cell;
          }
      });
  </code></pre>
  <p>And, <code>setButtonCell(ListCell)</code> method to show name in <code>combobox</code> on selection.</p>
  <pre><code>combobox.setButtonCell(
      new ListCell&lt;Object&gt;() {
          @Override
          protected void updateItem(Person t, boolean bln) {
              super.updateItem(t, bln); 
              if (bln) {
                  setText(&quot;&quot;);
              } else {
                  setText(t.getName());
              }
          }
      });
  </code></pre>
  <p>This works perfectly good with normal case but when I use editable <code>combobox</code> then this fails.</p>
  <p>When I write , <code>combobox.setEditable(true);</code> then on item selection the text field (editor) of <code>combobox</code> shows <code>toString()</code> method of <code>Person</code> class.</p>
  <p>Normal Case :
  <img src="https://i.stack.imgur.com/YlYh2.jpg" alt="Normal Case" /></p>
  <p>Editable Case :
  <img src="https://i.stack.imgur.com/0m20H.jpg" alt="Editable Case" /></p>
  <p>Is there any solution for this?</p>
  <p>I have a model class:</p>
  <pre><code>public class Person {
      String name;
      int age;
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public int getAge() {
          return age;
      }
  
      public void setAge(int age) {
          this.age = age;
      }
  
      @Override
      public String toString() {
          return &quot;Person{&quot; + &quot;name=&quot; + name + &quot;, age=&quot; + age + '}';
      }
  }
  </code></pre>