June 2017
Beginner
1296 pages
69h 23m
English
... 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 }
Custom ListView cell factory that displays an image and text.
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 ...
Read now
Unlock full access