I have a DefaultMutableTreeNode that sometimes collapses on certain
hardware (like a trackball) when the mouse hovers over a child node in
my JTree.
How can I lock this one single node from collapsing? It's a root node
that's hidden so that all the second level child nodes appear, making
them look like multiple root nodes.
Mark Holland - 26 Mar 2007 19:50 GMT
>I have a DefaultMutableTreeNode that sometimes collapses on certain
> hardware (like a trackball) when the mouse hovers over a child node
[quoted text clipped - 6 lines]
> making
> them look like multiple root nodes.
You could attach a listener to your tree, and prevent any collapse
events for the root node.
The following link has a good example on how to use this feature.
http://java.sun.com/docs/books/tutorial/uiswing/events/treewillexpandlistener.html
Mark