This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'm currently trying to work my way through Java and need some advice on using and traversing trees. I've written a basic JTree program, which allows the user to add and delete nodes. Each new node is labelled in a sequential order and not dependent upon where they are added to the tree.
Basically, what is the best way to add and delete these new nodes with labels that reflect their position in the tree in a depth-first traversal?
ie: the new node's label will correctly reflect its position in the tree and the other labels will change to reflect this addition of a new node.
I've searched Google and can't seem to find any appropriate examples for this case.