package test.scenegraph.app; import javafx.application.Application; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.beans.value.ObservableValue; import javafx.collections.ObservableList; import javafx.geometry.VPos; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.layout.Pane; import javafx.stage.Stage; import javafx.collections.FXCollections; import javafx.geometry.HPos; import javafx.geometry.Pos; import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn.CellDataFeatures; import javafx.scene.control.TableView; import javafx.scene.layout.FlowPane; import javafx.scene.layout.TilePane; import javafx.util.Callback; public class ShortAppWithoutDependencies51111 extends Application { public static void main(String[] args) { Application.launch(args); } @Override public void start(Stage stage) { Pane mainContainer = new Pane(); FlowPane pane = new FlowPane(); // TilePane pane = new TilePane(); pane.setLayoutX(50); pane.setLayoutY(50); pane.setStyle("-fx-border-color: red;"); mainContainer.getChildren().add(pane); pane.setMaxSize(300, 300); pane.setPrefSize(300, 300); pane.getChildren().add(createControl()); pane.getChildren().add(createControl()); pane.setHgap(10); pane.setAlignment(Pos.BOTTOM_LEFT); stage.setScene(new Scene(mainContainer, 400, 400)); stage.show(); } public Node createControl() { 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 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 CellDataFeatures p) { SimpleObjectProperty text = new SimpleObjectProperty(); text.setValue(new Label(p.getValue().getLastName())); return text; } }); TableView table = new TableView(items); table.getColumns().setAll(column1, column2); table.setPrefHeight(200); table.setFocusTraversable(false); return table; } 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; } } }