Observable Model

Previously, our Chapter class provided only a minimal set of APIs. The JavaFX documentation advises making all model fields into properties, which allow better flexibility and performance for the TableView code.

Let's update our Chapter class accordingly:

// chapter10/table/ObservableChapter.javapublic class ObservableChapter {    private final StringProperty titleProp = new SimpleStringProperty();    private final IntegerProperty numberProp = new SimpleIntegerProperty();    ObservableChapter(int number, String title) {        titleProp.set(title);        numberProp.set(number);    }    // Title    public String getTitle() {        return titleProp.get();    }    public void setTitle(String title) {        titleProp.set(title);    }    public StringProperty titleProperty() { return ...

Get Mastering JavaFX 10 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.