Balloon (@Nullable Component c) { if (c == null) return null; Component eachParent = c; while (eachParent != null) { if (eachParent instanceof JComponent) { Object balloon = ((JComponent)eachParent).getClientProperty(Balloon.KEY); if (balloon instanceof Balloon) { return (Balloon)balloon; } } eachParent = eachParent.getParent(); } return null; }