This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes need help with jTree  isNodeAncestor() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "need help with jTree  isNodeAncestor() " Watch "need help with jTree  isNodeAncestor() " New topic
Author

need help with jTree isNodeAncestor()

Max Simpson
Ranch Hand

Joined: Sep 23, 2004
Posts: 30
isNodeAncestor keeps returning false even though the value I pass in is an an ancestor node... here is what i am doing:

1. read a key from a HashMap and create a new node
2. before adding the new node (child) to the current node (node), I want to make sure that it is not an ancestor (parent or grandparent, etc..) of the current node. To do this I call:

node.isNodeAncestor(child);

But if always returns false.. my guess is that it is because the child node, even though it may be the same as an ancestor, is not the actual ancestor node.

Any idea on how I can make this work?
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need help with jTree isNodeAncestor()
 
Similar Threads
Algorithm to find Nodes having largest distance in Binary tree.
recursion backwards?
Path of TreeSelectionEvent
sorting node position in JTree
Node.getNodeValue() is not parsing "