... empty) {
34        // required to ensure that cell displays properly
35        super.updateItem(item, empty)
36
37        if (empty || item == null) {
38           setGraphic(null); // don't display anything
39        }
40        else {
41           // set ImageView's thumbnail image
42           thumbImageView.setImage(new Image(item.getThumbImage()));
43           label.setText(item.getTitle()); // configure Label's text
 44           setGraphic(vbox); // attach custom layout to ListView cell
45        }
46     }
47   }

Constructor

The constructor (lines 17–29) configures the instance variables we use to build the custom presentation. Line 18 indicates that the VBox’s children should be centered. Lines 20–22 configure the ImageView and attach it to the VBox’s collection of children. Line 20 indicates that the ImageView should preserve the ...

Get Java How To Program, Late Objects, 11th Edition 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.