List of usage examples for javafx.scene.control CheckBoxTreeItem CheckBoxTreeItem
public CheckBoxTreeItem(T value, Node graphic)
From source file:dpfmanager.shell.interfaces.gui.component.dessign.DessignView.java
private void addTreeView() { // Root node (my computer) CheckBoxTreeItem<String> rootNode = new CheckBoxTreeItem<>(getHostName(), new ImageView(new Image("images/computer.png"))); checkTreeView = new CheckTreeView<>(rootNode); rootNode.addEventHandler(TreeItem.<Object>branchExpandedEvent(), new ExpandEventHandler(checkTreeView)); rootNode.addEventHandler(TreeItem.<Object>branchCollapsedEvent(), new CollapseEventHandler()); // Root items Iterable<Path> rootDirectories = FileSystems.getDefault().getRootDirectories(); for (Path name : rootDirectories) { if (Files.isDirectory(name)) { FilePathTreeItem treeNode = new FilePathTreeItem(name); rootNode.getChildren().add(treeNode); }/*from w w w .ja v a 2 s . c om*/ } rootNode.setExpanded(true); // Add data and add to gui treeViewHBox.getChildren().clear(); treeViewHBox.getChildren().add(checkTreeView); HBox.setHgrow(checkTreeView, Priority.ALWAYS); }