O'Reilly logo

JavaFX 2.0: Introduction by Example by Carl Dea

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

1-14. Creating and Working with Tables

Problem

You want to display items in a UI table control similar to Java Swing’s JTable component.

Solution

Create an application using JavaFX’s javafx.scene.control.TableView class. The TableView control provides the equivalent functionality similar to Swing’s JTable component.

To exercise the TableView control you will be creating an application that will display bosses and employees. On the left you will implement a ListView control containing bosses, and employees (subordinates) will be displayed in a TableView control on the right.

Shown here is the source code of a simple domain (Person) class to represent a boss or an employee to be displayed in a ListView or TableView control:

package javafx2introbyexample.chapter1.recipe1_14; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required