title: JavaFx - How to display SimpleStringProperty value in TableView
body: <p>I am busy working through a tutorial and am stuck on one point.</p>
  
  <p>Basically launch new scene and display values from ObservableList of type Person in a table view.</p>
  
  <p>The person class consists of 3 SimpleStringProperty’s firsName, lastName and email.</p>
  
  <p>But when I run the app it seems to display the values of the SimpleStringProperty [StringProperty [value:actualvalue]] in the table and not the value of the SimpleStringProperty. If I change the Person’s class getFirstName method to return a String firstName.get() then it display the value correctly in the table.</p>
  
  <p>Am I supposed to use the SimpleStringProperty or rather plain objects like String?
  <img src="https://i.stack.imgur.com/gMHEO.jpg" alt="enter image description here"></p>
  
  <p>The person class</p>
  
  <pre><code>package co.za.chrispie.addressBook;
  
  import javafx.beans.property.SimpleStringProperty;
  
  public class Person {
  
  private SimpleStringProperty firstName;
  private SimpleStringProperty lastName;
  private SimpleStringProperty email;
  
  public Person(final String firstName, final String lastName, final String email) {
      this.firstName = new SimpleStringProperty(firstName);
      this.lastName = new SimpleStringProperty(lastName);
      this.email = new SimpleStringProperty(email);
  }
  
  public String getFirstName() {
      return firstName.get(); //Changes this method to return a String
  }
  
  public SimpleStringProperty getLastName() {
      return lastName;
  }
  
  public SimpleStringProperty getEmail() {
      return email;
  }
  
  }
  </code></pre>
  
  <p>The Controller class</p>
  
  <pre><code>/*
   * To change this template, choose Tools | Templates
   * and open the template in the editor.
   */
  package co.za.chrispie.addressBook;
  
  import java.net.URL;
  import java.util.ResourceBundle;
  import javafx.collections.FXCollections;
  import javafx.collections.ObservableList;
  import javafx.fxml.FXML;
  import javafx.fxml.Initializable;
  import javafx.scene.control.TableColumn;
  import javafx.scene.control.TableView;
  import javafx.scene.control.cell.PropertyValueFactory;
  
  public class OracleAddressBookController implements Initializable {
  
  @FXML
  TableView&lt;Person&gt; table;
  @FXML
  TableColumn&lt;Person, String&gt; colFirstName;
  @FXML
  TableColumn&lt;Person, String&gt; colLastName;
  @FXML
  TableColumn&lt;Person, String&gt; colEmail;
  
  final ObservableList&lt;Person&gt; data = FXCollections.observableArrayList(
      new Person("Jaco", "Pieters", "jp@me.co.za"),
      new Person("Chrispie", "Pieters", "chrispie@me.co.za")
  );
  
  @Override
  public void initialize(URL url, ResourceBundle rb) {
      assert colFirstName != null : "fx:id=\"colFirstName\" was not injected: check your FXML file 'OracleAddressBook.fxml'.";
      assert colLastName != null : "fx:id=\"colLastName\" was not injected: check your FXML file 'OracleAddressBook.fxml'.";
      assert colEmail != null : "fx:id=\"colEmail\" was not injected: check your FXML file 'OracleAddressBook.fxml'.";
      configureTable();
  }    
  
  private void configureTable() {
      colFirstName.setCellValueFactory(new PropertyValueFactory&lt;Person, String&gt;("firstName"));
      colLastName.setCellValueFactory(new PropertyValueFactory&lt;Person, String&gt;("lastName"));
      colEmail.setCellValueFactory(new PropertyValueFactory&lt;Person, String&gt;("email"));
  
      table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
  
      table.setItems(data);
      assert table.getItems() == data;
  }
  }
  </code></pre>
  
  <p>and the front end FXML</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import java.lang.*?&gt;
  &lt;?import java.net.*?&gt;
  &lt;?import java.util.*?&gt;
  &lt;?import javafx.scene.*?&gt;
  &lt;?import javafx.scene.control.*?&gt;
  &lt;?import javafx.scene.layout.*?&gt;
  
  &lt;AnchorPane id="AnchorPane" prefHeight="500.0" prefWidth="600.0"    styleClass="mainFxmlClass" xmlns:fx="http://javafx.com/fxml"  fx:controller="co.za.chrispie.addressBook.OracleAddressBookController"&gt;
  &lt;children&gt;
    &lt;Label layoutX="14.0" layoutY="11.0" text="Address Book" /&gt;
    &lt;TableView fx:id="table" layoutX="14.0" layoutY="35.0" prefHeight="451.0" prefWidth="572.0"&gt;
    &lt;columns&gt;
      &lt;TableColumn prefWidth="75.0" text="First Name" fx:id="colFirstName" /&gt;
      &lt;TableColumn prefWidth="75.0" text="Last Name" fx:id="colLastName" /&gt;
      &lt;TableColumn prefWidth="75.0" text="Email" fx:id="colEmail" /&gt;
    &lt;/columns&gt;
  &lt;/TableView&gt;
   &lt;/children&gt;
    &lt;stylesheets&gt;
     &lt;URL value="@oracleaddressbook.css" /&gt;
   &lt;/stylesheets&gt;
  &lt;/AnchorPane&gt;
  </code></pre>