package test.scenegraph.app; import javafx.application.Application; import javafx.beans.property.StringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.geometry.Insets; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.SelectionMode; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.layout.FlowPane; import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; import javafx.scene.layout.TilePane; import javafx.scene.text.Text; import javafx.stage.Stage; public class ShortAppWithoutDependencies51111 extends Application { final ObservableList data = FXCollections.observableArrayList( new Person("A Jacob", "Smith", "jacob.smith@example.com" ), new Person("B Isabella", "Johnson", "isabella.johnson@example.com" ), new Person("C Ethan", "Williams", "ethan.williams@example.com" ), new Person("D Emma", "Jones", "emma.jones@example.com" ), new Person("E Michael", "Brown", "michael.brown@example.com" ) ); public static void main(String[] args) { Application.launch(args); } @Override public void start(Stage stage) { Pane mainContainer = new Pane(); Pane pane = new FlowPane(); pane.setStyle("-fx-border-color: red;"); mainContainer.getChildren().add(pane); pane.setMaxSize(300, 80); pane.setPrefSize(300, 80); //pane.setPadding(new Insets(20)); //for (int i=0; i<5; ++i) pane.getChildren().add(makeTableView()); stage.setScene(new Scene(mainContainer,500,500)); stage.setVisible(true); } public TableView makeTableView() { TableView table = new TableView(); table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE_INTERVAL_SELECTION); table.setStyle("-fx-base: #b6e7c9;"); table.setMinWidth(10); table.setPrefWidth(80); table.setMaxWidth(1400); table.setMinHeight(4); // table.setPrefHeight(80); table.setMaxHeight(140); //table.setPlaceholder(new Circle(8){{setFill(Color.RED);}}); //table.setTooltip(new Tooltip("A-a-a-a-a-a-a!")); TableColumn firstNameCol = new TableColumn(); firstNameCol.setText("First"); firstNameCol.setProperty("firstName"); //TableColumn lastNameCol = new TableColumn(); TableColumn lastNameCol = new TableColumn(); lastNameCol.setText("First"); lastNameCol.setProperty("firstName"); lastNameCol.setText("Last"); lastNameCol.setProperty("lastName"); lastNameCol.setVisible(true); TableColumn emailCol = new TableColumn(); emailCol.setText("Email"); emailCol.setMinWidth(200); emailCol.setProperty("email"); table.setItems(data); table.getColumns().addAll(firstNameCol, lastNameCol, emailCol); return table; } public static class Person { StringProperty firstName; StringProperty lastName; StringProperty email; private Person(String fName, String lName, String email) { this.firstName = new StringProperty(fName); this.lastName = new StringProperty(lName); this.email = new StringProperty(email); } public String getFirstName() { return firstName.get(); } public void setFirstName(String fName) { firstName.set(fName); } public StringProperty firstNameProperty() { if (firstName == null) { firstName = new StringProperty(); } return firstName; } public String getLastName() { return lastName.get(); } public void setLastName(String fName) { lastName.set(fName); } public StringProperty lastNameProperty() { if (lastName == null) { lastName = new StringProperty(); } return lastName; } public String getEmail() { return email.get(); } public void setEmail(String fName) { email.set(fName); } public StringProperty emailProperty() { if (email == null) { email = new StringProperty(); } return email; } } }