title: Cannot understand ComboBoxTableCell in a TableView
body: <p>I have read everything available on this site and others; I have cut and pasted every line of code ever written on this subject ( am willing to bet). This is what the result is:</p>
  
  <pre><code>final class Books extends Group {
  
  private TableView table = new TableView();
  private ObservableList&lt;Book&gt; data = FXCollections.observableArrayList();
  final HBox hb = new HBox();
  final TextField Title = new TextField();
  final TextField Author = new TextField();
  final TextField Publisher = new TextField();
  final TextField Copywrite = new TextField();
  final TextField ISBN = new TextField();
  final Boolean CheckedOut = false;
  final Label Whom;
  final Button addButton = new Button("Add");
  Boolean FirstRead = true;
  
  public static class Book {
  
      private final SimpleStringProperty title;
      private final SimpleStringProperty author;
      private final SimpleStringProperty publisher;
      private final SimpleStringProperty copywrite;
      private final SimpleStringProperty isbn;
      private final BooleanProperty checkedout;
      private final SimpleStringProperty who;
  
      Book(String Titl, String Auth, String Publ,
              String Cpywrit, String IsBn, Boolean ChkdOut, String WHO) {
  
          this.title = new SimpleStringProperty(Titl);
          this.author = new SimpleStringProperty(Auth);
          this.publisher = new SimpleStringProperty(Publ);
          this.copywrite = new SimpleStringProperty(Cpywrit);
          this.isbn = new SimpleStringProperty(IsBn);
          this.checkedout = new SimpleBooleanProperty(ChkdOut);
          this.who = new SimpleStringProperty(WHO);
  
      }
  
      public boolean isCheckedOut() {
          return checkedout.get();
      }
  
      public void setCheckedOut(boolean international) {
          this.checkedout.set(international);
      }
  
      public BooleanProperty isCheckedOutProperty() {
          return checkedout;
      }
  
      public String getTitle() {
          return title.get();
      }
  
      public void setTitle(String Title) {
          title.set(Title);
      }
  
      public String getAuthor() {
          return author.get();
      }
  
      public void setAutor(String Author) {
          author.set(Author);
      }
  
      public String getPublisher() {
          return publisher.get();
      }
  
      public void setPublisher(String Publisher) {
          publisher.set(Publisher);
      }
  
      public String getCopywrite() {
          return copywrite.get();
      }
  
      public void setCopywrite(String Copywrite) {
          copywrite.set(Copywrite);
      }
  
      public String getIsbn() {
          return isbn.get();
      }
  
      public void setIsbn(String ISBN) {
          isbn.set(ISBN);
      }
  
      public Boolean getIo() {
          return checkedout.get();
      }
  
      public void setIo(Boolean CheckedOut) {
          checkedout.set(CheckedOut);
      }
  
      public String getWho() {
          return who.get();
      }
  
      public void setWho(String Who) {
          who.set(Who);
      }
  
      public ObservableValue&lt;String&gt; whoProperty() {
          return who;
      }
  }
  
  public Books(final File User) throws IOException {
  
      this.Whom = new Label("inLibrary");
      this.data = FXCollections.&lt;Book&gt;observableArrayList(
              (Book bk) -&gt; new Observable[]{bk.isCheckedOutProperty()
              });
      final PhoneList p = new PhoneList(User);
      final Label label = new Label("Book List");
      label.setFont(new Font("Arial", 20));
      table.setPrefSize(600, 400);
      table.setEditable(true);
      TableColumn nameCol = bookName();
      TableColumn authorCol = bookAuthor();
      TableColumn publisherCol = bookPublisher();
      TableColumn copywriteCol = bookCopywrite();
      TableColumn isbnCol = bookISBN();
  
      final TableColumn&lt;Book, Boolean&gt; ioCol = new TableColumn&lt;&gt;("In/Out");
      ioCol.setMinWidth(50);
      ioCol.setEditable(true);
      ioCol.setCellValueFactory(new PropertyValueFactory&lt;&gt;("isCheckedOut"));
      final Callback&lt;TableColumn&lt;Book, Boolean&gt;, TableCell&lt;Book, Boolean&gt;&gt; iocellFactory = CheckBoxTableCell.forTableColumn(ioCol);
      ioCol.setCellFactory((TableColumn&lt;Book, Boolean&gt; column) -&gt; {
          TableCell&lt;Book, Boolean&gt; iocell = iocellFactory.call(column);
          iocell.setAlignment(Pos.CENTER);
          return iocell;
      });
      ioCol.setCellFactory(iocellFactor
  
      final TableColumn&lt;String, Book&gt; whoCol = new TableColumn&lt;&gt;("Who to");
      whoCol.setMinWidth(100);
      whoCol.setEditable(true);
      whoCol.setCellValueFactory(new PropertyValueFactory&lt;&gt;("who"));
  
      whoCol.setCellFactory(ComboBoxTableCell.forTableColumn(new StringConverter&lt;Book&gt;() {
          @Override
          public String toString(Book string) {
              return string.getWho();
          }
          @Override
          public Book fromString(String string) {
              return null;
          }
      }, data));
  
  
      AddBook(nameCol, authorCol, publisherCol, copywriteCol, isbnCol, ioCol, whoCol, User);
  
      data.addListener((javafx.collections.ListChangeListener.Change&lt;? extends Book&gt; change) -&gt; {
          while (change.next()) {
              if (change.wasUpdated() &amp;&amp; FirstRead != true) {
                  try {
                      System.out.println("List changed");
                      writeFile(User);
                  } catch (IOException ex) {
                      Logger.getLogger(Books.class.getName()).log(Level.SEVERE, null, ex);
                  }
              }
          }
      });
  
      final VBox vbox = new VBox();
  
      vbox.setSpacing(5);
      vbox.setPadding(new Insets(10, 0, 0, 10));
      vbox.getChildren().addAll(label, table, hb);
      getChildren().addAll(vbox);
      try {
          readFile(User);
      } catch (Exception ex) {
          Logger.getLogger(Books.class.getName()).log(Level.SEVERE, null, ex);
      }
  }
  
  private TableColumn bookISBN() {
  
      TableColumn isbnCol = new TableColumn("ISBN #");
      isbnCol.setMinWidth(100);
      isbnCol.setCellValueFactory(
              new PropertyValueFactory&lt;&gt;("isbn"));
      isbnCol.setCellFactory(TextFieldTableCell.forTableColumn());
      return isbnCol;
  }
  
  private TableColumn bookCopywrite() {
  
      TableColumn copywriteCol = new TableColumn("Copywrite");
      copywriteCol.setMinWidth(100);
      copywriteCol.setCellValueFactory(
              new PropertyValueFactory&lt;&gt;("copywrite"));
      copywriteCol.setCellFactory(TextFieldTableCell.forTableColumn());
      return copywriteCol;
  }
  
  private TableColumn bookPublisher() {
  
      TableColumn publisherCol = new TableColumn("Publisher");
      publisherCol.setMinWidth(100);
      publisherCol.setCellValueFactory(
              new PropertyValueFactory&lt;&gt;("publisher"));
      publisherCol.setCellFactory(TextFieldTableCell.forTableColumn());
      return publisherCol;
  }
  
  private TableColumn bookAuthor() {
  
      TableColumn authorCol = new TableColumn("Author");
      authorCol.setMinWidth(100);
      authorCol.setCellValueFactory(
              new PropertyValueFactory&lt;&gt;("author"));
      authorCol.setCellFactory(TextFieldTableCell.forTableColumn());
      return authorCol;
  }
  
  private TableColumn bookName() {
  
      TableColumn nameCol = new TableColumn("Title");
      nameCol.setMaxWidth(100);
      nameCol.setCellValueFactory(
              new PropertyValueFactory&lt;&gt;("title"));
      nameCol.setCellFactory(TextFieldTableCell.forTableColumn());
      return nameCol;
  }
  
  private void AddBook(TableColumn nameCol, TableColumn authorCol, TableColumn publisherCol,
          TableColumn copywriteCol, TableColumn isbnCol, TableColumn ioCol, TableColumn whoCol, final File User) {
      table.setItems(data);
      table.getColumns().addAll(nameCol, authorCol, publisherCol, copywriteCol, isbnCol, ioCol, whoCol);
  
      addButton.setOnAction(
              new EventHandler&lt;ActionEvent&gt;() {
                  @Override
                  public void handle(ActionEvent e) {
                      addBook();
                      try {
                          writeFile(User);
                      } catch (IOException ex) {
                          Logger.getLogger(Books.class.getName()).log(Level.SEVERE, null, ex);
                      }
                  }
  
                  private void addBook() {
                      data.add(new Book(
                                      Title.getText(),
                                      Author.getText(),
                                      Publisher.getText(),
                                      Copywrite.getText(),
                                      ISBN.getText(),
                                      CheckedOut,
                                      Whom.getText()
                              ));
  
                      Title.clear();
                      Author.clear();
                      Publisher.clear();
                      Copywrite.clear();
                      ISBN.clear();
                  }
              });
  
      hb.getChildren().addAll(Title, Author, Publisher,
              Copywrite, ISBN, addButton);
      hb.setSpacing(10);
      Title.setPromptText("Tile of Book");
      Title.setMaxWidth(nameCol.getPrefWidth());
  
      Author.setMaxWidth(authorCol.getPrefWidth());
      Author.setPromptText("Author");
  
      Publisher.setMaxWidth(publisherCol.getPrefWidth());
      Publisher.setPromptText("Publisher");
  
      Copywrite.setMaxWidth(copywriteCol.getPrefWidth());
      Copywrite.setPromptText("Year Copywrite");
  
      ISBN.setMaxWidth(isbnCol.getPrefWidth());
      ISBN.setPromptText("ISBN #");
  }
  
  private void writeFile(File User) throws IOException {
      File file = new File(User + "/Books.txt");
      FileWriter fw = new FileWriter(file);
      BufferedWriter bw = new BufferedWriter(fw);
      PrintWriter outFile = new PrintWriter(bw);
  
      if (table.getItems() != null) {
          data.stream().map((data1) -&gt; {
              if (data1.getTitle().equals("")) {
                  data1.setTitle("No_Title");
              }
              return data1;
          }).map((data1) -&gt; {
              if (data1.getAuthor().equals("")) {
                  data1.setAutor("No_Author");
              }
              return data1;
          }).map((data1) -&gt; {
              if (data1.getPublisher().equals("")) {
                  data1.setPublisher("No_Publisher");
              }
              return data1;
          }).map((data1) -&gt; {
              if (data1.getCopywrite().equals("")) {
                  data1.setCopywrite("No_Copywrite");
              }
              return data1;
          }).map((data1) -&gt; {
              if (data1.getIsbn().equals("")) {
                  data1.setIsbn("No_ISBN");
              }
              return data1;
          }).map((data1) -&gt; {
              if (data1.getWho().equals("")) {
                  data1.setWho("InLibrary");
              }
              return data1;
          }).map((data1) -&gt; {
              outFile.println(data1.getTitle());
              return data1;
          }).map((data1) -&gt; {
              outFile.println(data1.getAuthor());
              return data1;
          }).map((data1) -&gt; {
              outFile.println(data1.getPublisher());
              return data1;
          }).map((data1) -&gt; {
              outFile.println(data1.getCopywrite());
              return data1;
          }).map((data1) -&gt; {
              outFile.println(data1.getIsbn());
              return data1;
          }).map((data1) -&gt; {
              outFile.println(data1.getIo());
              return data1;
          }).forEach((data1) -&gt; {
              outFile.println(data1.getWho());
          });
          outFile.close();
      }
  }
  
  private void readFile(File User) throws Exception {
      try {
          String name, author, publisher, copywrite, isbn, whom;
          Boolean InOut;
          try (Scanner inFile = new Scanner(new File(User + "/Books.txt"))) {
              while (inFile.hasNextLine()) {
                  name = inFile.next();
                  author = inFile.next();
                  publisher = inFile.next();
                  copywrite = inFile.next();
                  isbn = inFile.next();
                  InOut = inFile.nextBoolean();
                  whom = inFile.next();
  
                  data.add(new Book(name, author, publisher, copywrite,
                          isbn, InOut, whom));
              }
          }
          table.setItems(data);
  
      } //insert catch statements
      catch (FileNotFoundException exception) {
          System.out.println("File not found");
      } catch (ArrayIndexOutOfBoundsException AIOOBexception) {
          System.out.println("Array Index is out of bounds");
      } catch (IllegalArgumentException IAexception) {
          System.out.println("Divide by zero error");
      } catch (NoSuchElementException NAexception) {
      }
      FirstRead = false;
  }
  }
  </code></pre>
  
  <p>This gives the following error:</p>
  
  <pre><code>Exception in thread "JavaFX Application Thread" java.lang.ClassCastException: mediatracker.Books$Book cannot be cast to java.lang.String
      at mediatracker.Books$1.toString(Books.java:198)
  </code></pre>
  
  <p>Line 198 starts:</p>
  
  <pre><code> whoCol.setCellFactory(ComboBoxTableCell.forTableColumn(new StringConverter&lt;Book&gt;() {
  </code></pre>
  
  <p>Can anyone  type in the "theory" behind the ComboBoxTableCell, and list the parts necessary to accomoplish this. All I want to do is to change the value of the cell extracted from a PhoneList in another file.</p>