I have a ComboBox
of objects with GridPane
set as Graphic for displaying combobox list. GridPane
has 3 columns for image, item's label and a StackPane
. I want to click on StackPane
and get object that corresponds to this row, but through .getParent().getChildrenUnmodifiable().get(0)
I can only get label. If I use .getParent().getParent()
that will give me a cell of clicked row. If I'm just changing selection of combobox, I can retrieve object normaly. But how to get object, which stackpane was clicked?
Asked
Active
Viewed 244 times
0

Alyona
- 1,682
- 2
- 21
- 44
-
1By object you mean the gridPane? – Uluk Biy May 07 '15 at 10:09
-
I'm retrieving data from database using hibernate for this `ComboBox`. So it looks like `private ComboBox
groupPicker;`. I need to get Group object by pressing a `StackPane` inside `GridPane`. – Alyona May 07 '15 at 10:19
1 Answers
0
Assuming that you have added a mouse click listener to StackPane in your custom ListCell
without problem (since this mouse click event may be consumed by combobox row and not be propagated further to stackPane), you can call getItem()
in this mouse listener and access the related object of this cell.
All your layout nodes (GridPane, Stackpane etc.) are renderers of the cell's item. So you cannot access to item (object) by traversing this layout graph.

Uluk Biy
- 48,655
- 13
- 146
- 153