Building a Jtree from Array
Hi All,
I am fairly new to java and I am struggling with the JTree object.
Basically, I want to populate the JTree with the following data:
String[][] userGroups = {{“group 1, user1}, {group 1, user2}, {group 1, user3}, {group 2, user 4}, {group 2, user5,}, {group 3, user6}}
I would like the JTree to look like this:
Root
Group 1
- User1
- User2
- User3
Group 2
- User4
- User5
Group 3
- User6
Can someone please point me in the right direction on how to achieve this?
p.s.
I spent the last 3 days on trying to get it to work but without any luck.
Thanks