public void center(int centerVs) {
        Dimension otherSize = null;
        Dimension dialogSize = null;
        Point otherLocation = null;

        if ((centerVs != VS_PARENT) && (centerVs != VS_SCREEN)) {
            return;
        }
        
        // Center the dialog as directed.
        switch (centerVs) {
            case VS_PARENT:
                otherSize = getParent().getSize();
                otherLocation = getParent().getLocation();
                break;
            case VS_SCREEN:
                otherSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
                otherLocation = new Point(0, 0);
                break;
        }
        
        dialogSize = getSize();
        
        Point offset = new Point((otherSize.width - dialogSize.width) / 2, 
            (otherSize.height - dialogSize.height) / 2);
        
        setLocation(otherLocation.x + offset.x, otherLocation.y + offset.y);
    }