Set location of JDialog relative to JFrame
Is there a way to set a dialog location relative to a JFrame ? I would like to center the dialog to the frame that houses my GUI, instead the dialog often appears in the center of the screen rather than within the GUI. Is there a way to set a location relative to another JFrame You can: pass JFrame as argument for JDialog.setLocationRelativeTo(Component c) set to desired Point from JFrame to JDialog.setLocation(Point p) EDIT all Swing code must be done on EventDispatchThread , meaning that setVisible(true) should be wrapped into invokeLater EDIT2 when using the JFrame as Component c I am