File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Dynamic JTree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Dynamic JTree" Watch "Dynamic JTree" New topic

Dynamic JTree

Arjun Shastry
Ranch Hand

Joined: Mar 13, 2003
Posts: 1893
I am developing small swing application. On the left panel, there is JTable. When user selects a particular row, details of that record will be shown in jTree in right panel.
Number of nodes in JTree will vary depending on data.For example-
If data is "{ ^id^="lYc-YyMncNZDZUQvik--5NxUw/Y" ^1^(1)="Delhi" ^2^(2)="Harayana" ^3^(3)="Ind ia" }" then three nodes will be created.If data is
"{ ^id^="lYc-YyMncNZDZUQvik--5NxUw/Y" ^1^(1)="Kanpur" ^2^(2)="Uttar Pradesh" ^3^(3)="Ind ia" ^4^(4)="Asia" }"then JTree will show 4 nodes. Each node will show corresponding value of Control field.(^1^,^2^.. are control fields.)

which data structure should be used to parse this data and to populate JTree dynamically?

I agree. Here's the link:
subject: Dynamic JTree
It's not a secret anymore!