Optimal location for a modal JDialog to avoid stuck
问题 My Swing application has to show a modal dialog to the user. Sorry for not posting SSCCE. topContainer might be JFrame or JApplet . private class NewGameDialog extends JDialog { public NewGameDialog () { super(SwingUtilities.windowForComponent(topContainer), "NEW GAME", ModalityType.APPLICATION_MODAL); //add components here getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS)); //TODO: setSize(new Dimension(250, 200)); setLocation(650, 300); } } I start the dialog like