Finishing up the controller

Before we look at SocialMediaItemViewCell, there are two more controller items. The first is the list that holds the ListView data. Remember that ListView operates from an ObservableList. This lets us make changes to the data in the list, and have it automatically reflected in the user interface. To create that list, we'll use a JavaFX helper method when we define the class property as follows:

    private final ObservableList<SocialMediaItem> entriesList =  
      FXCollections.observableArrayList(); 

Then we need to connect that List to our ListView. Back in intialize(), we have the following:

    entriesListView.setItems(entriesList); 

To finish off the rendering of SocialMediaItem interfaces, let's define SocialMediaItemViewCell ...

Get Java 9: Building Robust Modular Applications 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.