From the course: Learning JavaFX GUI Development

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Use a TableView to display data

Use a TableView to display data

From the course: Learning JavaFX GUI Development

Start my 1-month free trial

Use a TableView to display data

- [Voiceover] The TableView class in Java Fx is similar to the ListView, but it allows us to have multiple columns of data. The TableView can be a bit difficult at first to use, but it is a great tool that we can use to create, display, and manage tables of information. The TableView class allows us to create a table of information with unlimited number of rows of data. A sample table might be a contact list containing the first name, last name, and cell phone number of all our contacts. To create a TableView, we first have to create a data model. We need to model what a contact looks like. Each row in the TableView represents the properties of one instance of our data model. So in our example, it would be one contact. It would be their name and their phone number. The TableView supports what we call cell factories, which allows us to easily customize the cell contents, and it contains built-in capabilities to sort data in columns. Let's look at our example. As I've already stated, we…

Contents