views:

32

answers:

2

Hello

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?

+1  A: 

You will just have orange and peach - you would need to check them for their children (grandchildren of the original node).


Edit: As derivation noted, you will also get Strawberry as that is a first level child - but the grandchildren will not be included in the enumeration.

aperkins
Think he will get strawberry too!
derivation
+1  A: 

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

Khnle