Hiding/filtering nodes in a JTree?

后端 未结 7 3029
暖寄归人
暖寄归人 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:05

    Take a look at this implementation: http://www.java2s.com/Code/Java/Swing-Components/InvisibleNodeTreeExample.htm

    It creates subclasses of DefaultMutableNode adding a "isVisible" property rather then actually removing/adding nodes from the TreeModel.

提交回复
热议问题