Hiding/filtering nodes in a JTree?

后端 未结 7 3033
暖寄归人
暖寄归人 2021-02-20 02:21

I have a data object represented in a TreeModel, and I\'d like to show only part of it in my JTree--for the sake of argument, say the leaves and their

7条回答
  •  说谎
    说谎 (楼主)
    2021-02-20 03:10

    Leverage the code you use to build your TreeNode(s) and rebuild the TreeNode(s) only including the elements you want. Set the root node on the TreeModel with the filtered root node.

提交回复
热议问题