?
Solved

JTree as renderer of combobox

Posted on 2007-03-26
6
Medium Priority
?
1,102 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 18794526
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 100 total points
ID: 18794540
0
 
LVL 30

Assisted Solution

by:Mayank S
Mayank S earned 100 total points
ID: 18794717
0
 
LVL 92

Expert Comment

by:objects
ID: 18796280
cannot be done (easily)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month9 days, 13 hours left to enroll

762 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