@Nullable public SwitchTarget getCellFor(Component c) { Component eachParent = c; while (eachParent != null) { for (GridCellImpl eachCell : myContent2Cell.values()) { if (eachCell.contains(eachParent)) { return eachCell.getTargetForSelection(); } } eachParent = eachParent.getParent(); } return null; }