0

我尝试为 root 设置孩子。但是不知何故,我的根是空的,尽管 treeNodes 已加载并具有价值。

TreeItem<String> treeNodes = null;
    for (int i = 0; i < rowSize; i++) {

         treeNodes
        = new TreeItem<>(rows.get(i));
        //rows.get(i)
         System.out.println(treeNodes);//is initialized

         root.getChildren().setAll(treeNodes);
         System.out.println(root);//is emty
    }
final TreeTableView<String> treeTableView = new TreeTableView<>(
            root);
TreeTableColumn<String, TreeMap<String, ArrayList<String>>> firstColumn = new TreeTableColumn<>();
    treeTableView.getColumns().add(firstColumn);// Tree column but no item in it, just an arrow facing down.
4

1 回答 1

0
    List<String> functions = new ArrayList<String>(dc.getNameOfFunction());
TreeItem<String> root = new TreeItem<>("Functions");
for (Entry<String, String> entryRow : dc.getSortedfuncAll().entrySet()) {
        root.getChildren().add(new TreeItem<String>(entryRow.getValue()));

    }
final TreeTableView<String> treeTableView = new TreeTableView<>(root);
于 2015-03-02T22:07:11.427 回答