Neel
Neel

Reputation: 10153

Printing contents of DefaultTreeModel

I am using javax.swing.tree.DefaultMutableTreeNode and javax.swing.tree.DefaultTreeModel for creating nodes and the tree itself.

How do I know print the contents of the entire tree? I need to do an BFS traversal.

Thanks, Neel

Upvotes: 1

Views: 600

Answers (1)

kleopatra
kleopatra

Reputation: 51535

Reading the api doc helps :-)

DefaultMutableTreeNode has traversal methods, a recent thread has a simple code snippet which uses it to print out the nodes with indentation.

Upvotes: 1

Related Questions