package org.jemmy.client; import javafx.application.Application; import javafx.beans.property.StringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.Scene; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.stage.Stage; /** * * @author Alexander Kouznetsov */ public class TableViewTest extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) throws Exception { TableView tableView = new TableView(); ObservableList teamMembers = FXCollections.observableArrayList( new Person("John", "Smith"), new Person("Victor", "Johnson") ); tableView.setItems(teamMembers); TableColumn firstNameCol = new TableColumn("First Name"); firstNameCol.setProperty("firstName"); TableColumn lastNameCol = new TableColumn("Last Name"); lastNameCol.setProperty("lastName"); tableView.getColumns().setAll(firstNameCol, lastNameCol); Scene scene = new Scene(tableView); stage.setScene(scene); stage.setVisible(true); } } final class Person { private StringProperty firstName = new StringProperty(); private StringProperty lastName = new StringProperty(); public void setFirstName(String value) { firstName.set(value); } public String getFirstName() { return firstName.get(); } public StringProperty firstNameProperty() { return firstName; } public void setLastName(String value) { lastName.set(value); } public String getLastName() { return lastName.get(); } public StringProperty lastNameProperty() { return lastName; } public Person(String firstName, String lastName) { setFirstName(firstName); setLastName(lastName); } }