Advanced controls
The most sophisticated JavaFX controls are ones that are dedicated to representing a large amount of data: ListView
and TableView
. We will review data management, cell creation, and editable data in the following sections.
ListView
ListView
is a familiar UI control, which represents a list of items shown in a scrollable column or row:

Despite the simple concept, JavaFX's ListView
has a large API, providing a lot of options to customize it for your needs.
Managing ListView items
The ListView
content is backed up by an ObservableList
and any changes to this list are automatically reflected in the ListView
, as in the button handler in the next example:
// chaptep10/list/ListViewDemo.java ObservableList<String> items = FXCollections.observableArrayList( "Red", "Blue", "Yellow", "Green"); ListView<String> list = new ListView<>(items); Button btn = new Button("Add New Item"); btn.setOnAction((e) -> { items.add( // just a way to generate semirandom...