Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

getParent returns null

843807May 12 2004 — edited May 12 2004
myApplet has a simple button on the middle of the Applet, when user clicks on the button a instance of JFrame pops up. when user closes the JFrame, I want to enable the button on the applet. So I want to getParent of JFrame, so I can get the button.

Component parent = jFrame.getParent();
To my surprise, parent is null already. Since I want to pass the parent to my following method to get myApplet.
private MyApplet getPopApplet(Component parent){
while(parent!=null && !(parent instanceof PopApplet)) {
System.out.println("not popApplet");
parent= ((Component)parent).getParent();
}
return (PopApplet)parent;
}
Any idear? Who jFrame.getParent is already null?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 9 2004
Added on May 12 2004
1 comment
407 views