Is there an easy way to find the "parent" of an object?
Posted on 2004-10-20
I understand that I can find the parents of components by using getParent(). But how would you get access to the object that instantiated the "child"?
Is there a way to do this without actually passing the "parent" as a parameter into the constructor?
ChildClass c = new ChildClass();
ParentClass p = (ParentClass) getTheParentClass(); // should return the ParentClass that instantiated it