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!

setLocation() relative to its parent?

843807Jul 15 2010 — edited Jul 16 2010
According to api doc:
public void setLocation(int x,int y)
Moves this component to a new location. The top-left corner of the new location is specified by the x and y parameters in the coordinate space of this component's parent.

However, I construct a JDialog like this:
JDialog aDialog=new JDialog(aFrame,"haha");  //aFrame is a JFrame object which displays normally
aDialog.setLocation(10,10);
then the aDialog 'ignores' its parent -- aFrame and set location relative to the window screen. this seems to contradict with the above doc

why so?
thanks in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 13 2010
Added on Jul 15 2010
8 comments
1,622 views