How can I display nodes in a tree in alphabetical order?

Simon Brown

You should ensure that you underlying data is sorted when your tree model is built. For example, if building a TreeModel based upon a list of objects, you could sort the list using the Collections.sort() method and optionally, a Comparator.

[FAQ Manager Note] Alternatively, you could create a filtering model that changes the order of nodes as they're requested. This allows you to have mulitple sorting orders on the same actual data.

See for some examples of this, using a TableModel. You could do similar processing with a TreeModel.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact