Question

I'm trying to create a ComboBox with a TreeView. So that when I select the combobox I see an expanded Tree like along the lines of this;

[Manufacturer] <- Root node (may or may not be visible),
- Apple
-- iPhone
-- iPad
- Microsoft
-- Surface Pro
-- Office

I'm somewhat at a loss as to how to implement this. I've gotten a TreeView to display in a ListCell.
However there is one tree for each "item" in comboBox.getItems() and I can't get the selection to show in the combobox.

Editing is not required, just displaying and of course selection.

So I'm looking for any pointers as to how to implement this in a semi-sane way.

Was it helpful?

Solution

Inserting a treeview inside a combobox is not the right approach, you need to implement your own custom control to achieve this, I have just completed my code to do a similar requirement on a table cell and have pasted it for reference in an earlier question, you can use that to create your own popup.

Java FX8 TreeView in a table cell

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top