package test.scenegraph.app; import javafx.application.Application; import javafx.geometry.Pos; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.TreeItem; import javafx.scene.control.TreeView; import javafx.scene.layout.BorderPane; import javafx.scene.layout.Pane; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; public class ShortAppWithoutDependencies52 extends Application { public Node createControl() { TreeItem root = new TreeItem("ROOT", new Rectangle(20, 20, Color.CHOCOLATE)); root.setExpanded(true); TreeItem firstBrunch = new TreeItem("brunch 1"); firstBrunch.setExpanded(true); firstBrunch.getChildren().addAll(new TreeItem("first item"), new TreeItem("second item", new Rectangle(20, 20, Color.DARKGREY))); root.getChildren().addAll(firstBrunch); TreeItem secondBrunch = new TreeItem("brunch 2"); secondBrunch.getChildren().addAll(new TreeItem("first item"), new TreeItem("second item", new Rectangle(20, 20, Color.DARKGREY))); root.getChildren().addAll(secondBrunch); TreeView tree = new TreeView(root); tree.setFocusTraversable(false); tree.setPrefSize(100, 100); return tree; } public static void main(String[] args) { Application.launch(args); } @Override public void start(Stage stage) { Pane mainContainer = new VBox(); BorderPane bp = new BorderPane(); mainContainer.getChildren().add(bp); final Node control = createControl(); bp.setRight(control); bp.setMinSize(200, 200); bp.setPrefSize(200, 200); bp.setMaxSize(200, 200); bp.setStyle("-fx-border-color: red; -fx-background-color: yellow;"); bp.setRight(control); BorderPane.setAlignment(control, Pos.BOTTOM_RIGHT); stage.setScene(new Scene(mainContainer, 500, 500)); stage.show(); } }