import com.sun.javafx.runtime.VersionInfo; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import javafx.application.Application; import javafx.application.Platform; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.Pagination; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.layout.HBox; import javafx.stage.Stage; import javafx.util.Callback; public class JavaApplication17 extends Application { @Override public void start(Stage stage) throws Exception { HBox root = new HBox(30); ObservableList items = FXCollections.observableArrayList(); for (int i = 0; i < 10; i++) { items.add(new Person("name " + i, "surname " + i)); } TableColumn column1 = new TableColumn("First Name"); column1.setCellValueFactory(new Callback, ObservableValue>() { @Override public ObservableValue call(final TableColumn.CellDataFeatures p) { SimpleObjectProperty text = new SimpleObjectProperty(); text.setValue(new Label(p.getValue().getFirstName())); return text; } }); TableColumn column2 = new TableColumn("Last Name"); column2.setCellValueFactory(new Callback, ObservableValue>() { @Override public ObservableValue call(final TableColumn.CellDataFeatures p) { SimpleObjectProperty text = new SimpleObjectProperty(); text.setValue(new Label(p.getValue().getLastName())); return text; } }); final TableView table = new TableView(items); table.getColumns().setAll(column1, column2); table.setPrefHeight(200); table.setFocusTraversable(false); ScheduledExecutorService s = Executors.newScheduledThreadPool(1); s.schedule(new Runnable() { @Override public void run() { Platform.runLater(new Runnable() { @Override public void run() { table.setStyle("-fx-border-color:red;-fx-border-width:10;"); } }); } }, 5, TimeUnit.SECONDS); root.getChildren().add(table); Scene scene = new Scene(root, 300, 300); stage.setScene(scene); stage.setTitle(VersionInfo.getRuntimeVersion()); stage.show(); } /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } public static class Person { Person(String firstName, String lastName) { this.firstName = new SimpleStringProperty(firstName); this.lastName = new SimpleStringProperty(lastName); } public StringProperty firstName; public void setFirstName(String value) { firstName.set(value); } public String getFirstName() { return firstName.get(); } public StringProperty firstNameProperty() { if (firstName == null) { firstName = new SimpleStringProperty(); } return firstName; } public StringProperty lastName; public void setLastName(String value) { lastName.set(value); } public String getLastName() { return lastName.get(); } public StringProperty lastNameProperty() { if (lastName == null) { lastName = new SimpleStringProperty(); } return lastName; } } }