• Post Reply Bookmark Topic Watch Topic
  • New Topic

Alphabetical Nodes in JTree  RSS feed

 
Jain Neeraj
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends,
Is there any method in java API which let's me display the nodes in a JTree in alphabetical order. Or there is some other way around for it?
Thanks,
N.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I know, you will have to sort your nodes prior to making them nodes. They will be added the way you add them. I believe the Collections Class will sort a List, but I would have to double check.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!