java - How to get the parent container of a JWindow in Swing? -


i have 1 jframe , calling jdialog frame while initializing. in dialog have jbutton, when clicking on button new jwindow opens.

can fix position of window in main frame? how access parent container (jframe extended) jwindow extended class?

use swingutilities.getwindowancestor, if inside jwindow class, refer this, if no, put object inside:

jframe topframe = (jframe) swingutilities.getwindowancestor(this);  jframe topframe = (jframe) swingutilities.getwindowancestor(myjwindow); 

Comments