dialog.setLocationRelativeTo(parentComponent);
  public static int showConfirmDialog(Component parentComponent, Object message)  {    JOptionPane pane = new JOptionPane(message, QUESTION_MESSAGE);    JDialog dialog = pane.createDialog(parentComponent, "Select an Option");    dialog.pack();    dialog.show();        if (pane.getValue() instanceof Integer)      return ((Integer) pane.getValue()).intValue();    return -1;  }