views:

169

answers:

3

I am looking for a way to create a nested tree structure in my GUI. I have a few "boxes" that have items in them. I would like the boxes to be collapsed but expanded when clicked on, like the way folders are navigated on the sidebar. The first way I considered was treating the "boxes" as JList, with the items in each box stored in a nested JList. This seems like a very complicated and poor way of doing it. It also prevents the boxes from being collapsible without extensive modifications to the actionlistener. I was hoping someone might know of an API perhaps for displaying file navigation that might be used here.

+2  A: 

Perhaps you are looking for something like this.

jt
Looks good but you should expand the comment a bit.
Mark Carey
+1  A: 

How to Use Trees

camickr
+2  A: 

It sounds like you are looking for JTree. There is a tutorial on using JTree.

vkraemer