Link to home
Start Free TrialLog in
Avatar of phavardel
phavardel

asked on

JTree as renderer of combobox

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?
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

You need to write your own ListCellRenderer. See API doc

http://java.sun.com/javase/6/docs/api/javax/swing/ListCellRenderer.html
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
cannot be done (easily)