import javafx.application.Application; import javafx.builders.StackPaneBuilder; import javafx.scene.Parent; 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(); TableColumn tableColumn1 = new TableColumn("AAAAAAAAAAAAA"); tableColumn1.setPrefWidth(5); TableColumn tableColumn2 = new TableColumn("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"); tableColumn2.setPrefWidth(5); TableColumn tableColumn3 = new TableColumn("C"); tableColumn3.setPrefWidth(5); tableView.getColumns().addAll(tableColumn1, tableColumn2, tableColumn3); Parent root = StackPaneBuilder.create() .children(tableView) .build(); Scene scene = new Scene(root, 300, 300); stage.setScene(scene); stage.setVisible(true); } }