Why my JavaFX TableView is empty

The value you passed to the PropertyValueFactory (rName) does not match the property defined in your model class Table by the get and set method names.

Since you passed “rName”, the PropertyValueFactory will first look for a method called rNameProperty() returning an ObservableValue<String>. Since none exists, it will look for a method getRName() returning a String. Since that doesn’t exist either, your have no value to display in the column. (See the Javadocs for a full description.)

Either change the cell value factory:

iName.setCellValueFactory(new PropertyValueFactory<Table, String>("name"));

or change the method names in the Table class to getRName() and setRName(...).

Leave a Comment