How to disable expand sign in Swing JTree?
Posted
by
user2899630
on Stack Overflow
See other posts from Stack Overflow
or by user2899630
Published on 2013-10-20T08:35:44Z
Indexed on
2013/10/20
9:54 UTC
Read the original article
Hit count: 235
I'm working in Swing and I would like to disable the expand (plus [+]) sign on a certain type of nodes.
Not sure how to do it because my nodes aren't leaves and I also cannot use setShowsRootHandles
(which is only for the root).
I'm referring to to JTree: suppose i got this structure:
Root
--[+] node1
--[+] node2
when I load this structure i would like not to see the [+] sign on node2 (because it a special type node). But I also would like to expand it by using a special command.
I've overridden isLeaf() (method from DefaultMutableTreeNode) so it would set to to TRUE when i'm in the special type node, but then when I'm trying to expand it, it wouldn't expand because isLeaf() == TRUE...
Hope this will make things more clear.
© Stack Overflow or respective owner