Example usage for javafx.scene.control TreeView autosize

List of usage examples for javafx.scene.control TreeView autosize

Introduction

In this page you can find the example usage for javafx.scene.control TreeView autosize.

Prototype

public final void autosize() 

Source Link

Document

If the node is resizable, will set its layout bounds to its current preferred width and height.

Usage

From source file:main.Content.java

public void showTreeView() {
    try {//from   w  ww  .j  a  v a2s .c  om
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(Main.class.getResource("view/TreePane.fxml"));
        AnchorPane activityPaneOverview = (AnchorPane) loader.load();

        TreeViewController controller = loader.getController();
        ScrollPane scrollPane = new ScrollPane();

        controller.setMainApp(this);
        controller.setTableData(data);
        controller.startTreeView();

        TreeView<String> treeView = controller.getTree();

        scrollPane.setContent(treeView);
        treeView.autosize();

        activityPaneOverview.getStylesheets()
                .add(Main.class.getResource("view/DarkTheme.css").toExternalForm());

        activityPaneOverview.getChildren().add(scrollPane);
        activityPaneOverview.setTopAnchor(scrollPane, 10.0);
        activityPaneOverview.setLeftAnchor(scrollPane, 10.0);
        activityPaneOverview.setRightAnchor(scrollPane, 10.0);
        activityPaneOverview.setBottomAnchor(scrollPane, 10.0);

        scrollPane.setFitToHeight(true);
        scrollPane.setFitToWidth(true);

        rootLayout.setLeft(activityPaneOverview);

        System.out.println("showTreeOveerview u therrit" + index);

    } catch (IOException e) {
        e.printStackTrace();
    }
}