2

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.

1
  • @jon clements, don't forget to delete the accepted answer since it provides the same link. Commented Nov 11, 2015 at 3:17

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

Comments

1

Perhaps you are looking for something like this.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.