JavaFX Treeview shows no items

后端 未结 1 1745
梦毁少年i
梦毁少年i 2021-01-29 01:58

I try to implement an TreeView in my JavaFX App. But unfortenatly no items are showed, but i cannot find an issue. I search for some example and did it like them.

I put

相关标签:
1条回答
  • 2021-01-29 02:36

    You shouldn't assign new instance to the this.treeview because this field was already initialized by the FXLoader. So instead of this.treeview = new TreeView<>(root); you need simply to set the root item this.treeview.setRoot(root);

    0 讨论(0)
提交回复
热议问题