Search code examples
javaenumerationchildren

Children in Enumeration


I have a enumeration for elements in a JTree

When I find some specific element in this JTree, I want to check it's children. Do the method children() in a Enumeration check it's grandcildren too?

For example, let's supose this JTree, considering the identation as new levels of the tree:

  • Fruits
    • apple
    • grape
      • orange
      • peach
        • pineapple
      • strawberry
    • banana

If I get the children of grape, will I have just orange, peach and strawberry or will I get peach children (pineaple) too?


Solution

  • You would just get orange, peach and strawberry. As a side note for future reference, this kind of behavior is almost a de facto.