Ejemplo n.º 1
0
  @Override
  public ButtonPanel createButtonPanel() {
    ButtonPanel buttonPanel = new ButtonPanel(0);
    JButton okButton = new JButton();
    JButton cancelButton = new JButton();
    okButton.setName("OK");
    cancelButton.setName("CANCEL");
    buttonPanel.addButton(okButton, "AFFIRMATIVE");
    buttonPanel.addButton(cancelButton, "CANCEL");

    okButton.setAction(
        new AbstractAction(UIDefaultsLookup.getString("OptionPane.okButtonText")) {
          @Override
          public void actionPerformed(ActionEvent e) {
            ColumnOptionDialog.this.fnHideColumn();
            ColumnOptionDialog.this.setDialogResult(0);
            ColumnOptionDialog.this.setVisible(false);
            ColumnOptionDialog.this.dispose();
          }
        });
    cancelButton.setAction(
        new AbstractAction(UIDefaultsLookup.getString("OptionPane.cancelButtonText")) {
          @Override
          public void actionPerformed(ActionEvent e) {
            ColumnOptionDialog.this.setDialogResult(-1);
            ColumnOptionDialog.this.setVisible(false);
            ColumnOptionDialog.this.dispose();
          }
        });
    setDefaultCancelAction(cancelButton.getAction());
    setDefaultAction(okButton.getAction());
    getRootPane().setDefaultButton(okButton);
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    return buttonPanel;
  }
Ejemplo n.º 2
0
  @Override
  public ButtonPanel createButtonPanel() {
    ButtonPanel buttonPanel = new ButtonPanel();
    JButton okButton = new JButton();
    JButton cancelButton = new JButton();
    JButton helpButton = new JButton();
    okButton.setName(OK);
    cancelButton.setName(CANCEL);
    helpButton.setName(HELP);
    buttonPanel.addButton(okButton, ButtonPanel.AFFIRMATIVE_BUTTON);
    buttonPanel.addButton(cancelButton, ButtonPanel.CANCEL_BUTTON);
    buttonPanel.addButton(helpButton, ButtonPanel.HELP_BUTTON);

    okButton.setAction(
        new AbstractAction(UIDefaultsLookup.getString("OptionPane.okButtonText")) {
          public void actionPerformed(ActionEvent e) {
            setDialogResult(RESULT_AFFIRMED);
            setVisible(false);
            dispose();
          }
        });
    cancelButton.setAction(
        new AbstractAction(UIDefaultsLookup.getString("OptionPane.cancelButtonText")) {
          public void actionPerformed(ActionEvent e) {
            setDialogResult(RESULT_CANCELLED);
            setVisible(false);
            dispose();
          }
        });
    final ResourceBundle resourceBundle = ButtonResources.getResourceBundle(Locale.getDefault());
    helpButton.setAction(
        new AbstractAction(resourceBundle.getString("Button.help")) {
          public void actionPerformed(ActionEvent e) {
            // do something
          }
        });
    helpButton.setMnemonic(resourceBundle.getString("Button.help.mnemonic").charAt(0));

    setDefaultCancelAction(cancelButton.getAction());
    setDefaultAction(okButton.getAction());
    getRootPane().setDefaultButton(okButton);
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    return buttonPanel;
  }
Ejemplo n.º 3
0
  /*
   * (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;
  }