List of usage examples for javafx.scene.control TreeView autosize
public final void autosize()
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(); } }