Solved

JTree as renderer of combobox

Posted on 2007-03-26
6
1,088 Views
Last Modified: 2012-06-22
Hi,

I want to create a ComboBox that, when the down arrow is clicked, instead of a list coming up, a JTree comes up (generally it'll be just like a list, but sometimes things will be nested 1 level).

The user can choose a node in the JTree, and that becomes the selected item (showing up in the un-expanded combobox and, preferably, firing an even with it as the newly selected object).

Could somebody at least point me in the right direction of where to start?
0
Comment
Question by:phavardel
  • 2
6 Comments
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
You need to write your own ListCellRenderer. See API doc

http://java.sun.com/javase/6/docs/api/javax/swing/ListCellRenderer.html
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 25 total points
Comment Utility
0
 
LVL 30

Assisted Solution

by:mayankeagle
mayankeagle earned 25 total points
Comment Utility
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
cannot be done (easily)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now