Defining user interface behavior

While we can define the structure of the user interface in FXML in all but the most trivial applications, the user interface still requires some Java code to finish defining its behavior. We'll do that now in DeskDroidController.initialize(). We'll start with the left side of the user interface, the conversation list, as follows:

 @FXML private ListView<Conversation> convList; private final ObservableList<Conversation> conversations = FXCollections.observableArrayList(); private final SimpleObjectProperty<Conversation> conversation = new SimpleObjectProperty<>(); @Override public void initialize(URL url, ResourceBundle rb) { convList.setCellFactory(list -> new ConversationCell(convList)); convList.setItems(conversations); ...

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.