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 a
You should give this
as the argument for the parent
parameter when you construct the dialog (when you call it from a JFrame class that is usually your mainform). Unless you give code in your question, I cannot give more detailed help...
Edit: To center it within the parent, do this:
MyDialog dialog = new MyDialog(this, true); //or false for non-modal
dialog.setLocation(this.getWidth/2 - dialog.getWidth/2, this.getHeight/2 - dialog.getHeight/2);
dialog.setVisible(true);