/** @throws java.awt.HeadlessException */
  public MapPropertyDialog(
      Frame owner, String headerText, String comment, Map map, boolean editable)
      throws HeadlessException {
    super(owner, headerText, true);

    mapPanel = new MapPropertyPanel(comment, map, editable);
    mapPanel.init();
    pack();
    setLocationRelativeTo(null);
  }
  /*
   * (non-Javadoc)
   *
   * @see com.jidesoft.dialog.StandardDialog#createButtonPanel()
   */
  public ButtonPanel createButtonPanel() {
    final ButtonPanel buttonPanel = new ButtonPanel(SwingConstants.RIGHT);

    AbstractAction okButtonAction =
        new AbstractAction(UIManager.getString("OptionPane.okButtonText")) {
          /** */
          private static final long serialVersionUID = -7972988497933837263L;

          public void actionPerformed(ActionEvent arg0) {
            mapPanel.doOK();
            setDialogResult(RESULT_AFFIRMED);
            setVisible(false);
            dispose();
          }
        };

    AbstractAction cancelButtonAction =
        new AbstractAction(UIManager.getString("OptionPane.cancelButtonText")) {
          /** */
          private static final long serialVersionUID = -4199961023918150328L;

          public void actionPerformed(ActionEvent arg0) {
            mapPanel.doCancel();
            setDialogResult(RESULT_CANCELLED);
            setVisible(false);
            dispose();
          }
        };

    JButton okButton = new JButton(okButtonAction);
    JButton cancelButton = new JButton(cancelButtonAction);

    buttonPanel.addButton(okButton);
    buttonPanel.addButton(cancelButton);
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    cancelButton.setEnabled(mapPanel.isEditable());

    return buttonPanel;
  }
 public void addOKAction(Runnable r) {
   mapPanel.addOKAction(r);
 }