Game Development Reference
In-Depth Information
The JavaFX TableView Class: Displaying Data Tables
in a Design
The TableView class is a public class that directly extends the
javafx.scene.control.Control superclass, which is an extension of
javafx.scene.layout.Region. javafx.scene.layout.Region is an extension of the
javafx.scene.Parent, which is an extension of the javafx.scene.Node Scene Graph su-
perclass (see Chapter 4 ) . A TableView<S> object is therefore a type of UI control (a
table) and a Node object in the JavaFX Scene Graph that is used for constructing a
table, using S objects, each of which contains data to be displayed in a table. You will
be writing data into a TableView<S> object later in the topic, using these S objects,
after scores have been achieved that eclipse those currently listed in the table.
The Java class hierarchy for the TableView class starts with the java.lang.Object
master class and uses this class to create the javafx.scene.Node class, which is then
used to create a Parent class. This is used to create a Region class, which in turn creates
a Control class, which is used to create the TableView class. The TableView class has
the following Java class inheritance hierarchy structure:
java.lang.Object
> javafx.scene.Node
> javafx.scene.Parent
> javafx.scene.layout.Region
> javafx.scene.control.Control
> javafx.scene.control. TableView<S>
The TableView class provides two different (overloaded) TableView() constructor
methods, an empty constructor and a constructor that takes an ObservableList<S> ob-
ject, filled with Table data items as a parameter. A simple (empty) TableView() con-
structor method to create an empty TableView object will use the following format:
TableView()
The second constructor type uses an ObservableList<E> class (object) from the
javafx.collections package, which is a type of list that allows a data change event
listener to track any changes in the list as they occur. This TableView object construct-
or method call uses the following format:
TableView(ObservableList<S> items )
Search WWH ::




Custom Search