Ok what I'm trying to do is take information from a text file and make a program so that when you run it it displays the information from the text file in a tree or tree map in the correct order. With the coding I've tried it only seems to map the files or isnt reading the information right in my text file. Does anyone have any tips that might throw me in the right direction here? The text file contains something like this:
0:-1:BankSys
10:8:Balance
11:8:Transactions
12:9:Balance
13:9:Transactions
14:7:Transfer
15:7:Withdraw
16:7:Deposit
17:7:Loans
18:17:Overview
19:17:Take new
1:0:Self service
2:0:Personal service
3:0:Disconnect
4:1:Stockmarket
5:4:Buy
6:4:Sell
7:1:Accounts
8:7:Current
9:7:Savings
First, take a look at DefaultTreeModel.
Second, sort your text file by the first number.
Third, insert the text lines as nodes on the DefaultTreeModel, based on the second number. The second number tells you which node the leaf should be attached to.