Re: How to lock a tree node so that it won't ever collapse



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.

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


.



Relevant Pages

  • howdo i have a right click cause a tree node to become selected?
    ... I have a treeview with several root nodes, each ... right click on a childNode I still get the context menu options for the ... This happening becuase the right click on said child node does not cause it ... the parent node remains the selected node! ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • I want a right click to cause a treenode to become selected, how?
    ... I have a treeview with several root nodes, each ... right click on a childNode I still get the context menu options for the ... This happening becuase the right click on said child node does not cause it ... the parent node remains the selected node! ...
    (microsoft.public.dotnet.general)
  • Re: I want a right click to cause a treenode to become selected, how?
    ... >> Okay, new to win forms; I have a treeview with several root nodes, each ... I also havea context ... >> This happening becuase the right click on said child node does not cause ... the parent node remains the selected node! ...
    (microsoft.public.dotnet.general)