use of com.jfoenix.controls.JFXTreeView in project JFoenix by jfoenixadmin.
the class TreeViewDemo method start.
@Override
public void start(Stage stage) {
rootNode.setExpanded(true);
JFXTreeView<String> treeView = new JFXTreeView<>(rootNode);
for (Employee employee : employees) {
TreeItem<String> empLeaf = new TreeItem<>(employee.getName());
boolean found = false;
for (TreeItem<String> depNode : rootNode.getChildren()) {
if (depNode.getValue().contentEquals(employee.getDepartment())) {
depNode.getChildren().add(empLeaf);
found = true;
break;
}
}
if (!found) {
TreeItem<String> depNode = new //,new ImageView(depIcon) // Set picture
TreeItem<>(//,new ImageView(depIcon) // Set picture
employee.getDepartment());
rootNode.getChildren().add(depNode);
depNode.getChildren().add(empLeaf);
}
}
stage.setTitle("Tree View Sample");
VBox box = new VBox();
final Scene scene = new Scene(box, 400, 300);
scene.setFill(Color.LIGHTGRAY);
box.getChildren().add(treeView);
stage.setScene(scene);
stage.show();
}
Aggregations