I am progammatically expanding a JTree but the last most nodes do not expand. I'm using code I found on this forum: tree.getRowCount(), tree.expandRow(i), etc. I've also tried expandPath, but the problem remains.
I'm building a tree that looks like this:
root
|
- S1
| |
| - A1
| |
| - A2
|
- S2
|
- A3
|
- A4
First I create node S1 and add to root. Then I create node A1, add to S1, then create A2 and add to A1. Tree appears expanded during these operations.
Then I create S2 and add to root. No problems. However, when I add A3 to S2, node S2 is not expanded. When I add A4 to A3, S2 remainds collapsed. Can anyone tell me what's happening and how I make all rows of the tree to be expanded when new nodes are added. I notice that tree.getRowCount() returns 3, so it doesn't seem to count rows for the 'A' nodes.
Thanks for your help.