setLocation(p.getLocation().x + p.getSize().width/2 - getSize().width/2, p.getLocation().y + p.getSize().height/2 - getSize().height/2);
Dimension size = getSize(); boolean updateSize = false; if ( size.width < Settings.minimumSizeWidth ) { size.width = Settings.minimumSizeWidth; } if ( size.height < Settings.minimumSizeHeight ) { size.height = Settings.minimumSizeHeight; } if ( updateSize ) { setSize( size ); size = getSize(); } setLocation(p.getLocation().x + p.getSize().width/2 - size.width/2, p.getLocation().y + p.getSize().height/2 - size.height/2);
    private void finishSetup(Frame p) {        addWindowListener(new WindowAdapter() {                public void windowClosing(WindowEvent e) {                    setVisible(false);                }            });        pack();        setLocation(p.getLocation().x + p.getSize().width/2 - getSize().width/2,                    p.getLocation().y + p.getSize().height/2 - getSize().height/2);    }