dialog.pack(); dialog.setLocationRelativeTo(parentComponent);
  public static void showMessageDialog(Component parentComponent,                                       Object message)  {    JOptionPane pane = new JOptionPane(message, INFORMATION_MESSAGE);    JDialog dialog = pane.createDialog(parentComponent, null);    dialog.pack();    dialog.setLocationRelativeTo(parentComponent);    dialog.show();  }