我尝试为 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.