Enumerating a JTree

R

Roedy Green

How can I list all the nodes in a JTree?

method 1.
find all the nodes in the root. Then recursively call your function
on each of those nodes.

method 2,
read up on the visitor pattern.
 
A

Andrey Kuznetsov

DefaultMutableTreeNode#depthFirstEnumeration()
DefaultMutableTreeNode#breadthFirstEnumeration()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Modify JTree look and feel 7
JTree 1
JTree Selection lost when JTree looses focus 3
Display an image in a JTree 2
JTree problem 2
JTree Selection 1
How to serialize/deserialize a JTree ? 1
JTree.... 1

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top