Ejemplo n.º 1
0
 public void dispose(boolean toDispose) {
   if (toDispose) {
     super.dispose();
     frame.toFront();
   }
   if (client != null) client.dialogDismissed(this);
 }
Ejemplo n.º 2
0
  // implementation of java.awt.event.ActionListener interface
  public void actionPerformed(JCActionEvent e) {
    if (e.getSource() == ok || e.getSource() == cancel) {
      if (e.getSource() == ok) {
        accept = true;
      } else {
        accept = false;
      }

      dialog.dispose();
    } else {
      JCButton b = (JCButton) e.getSource();
      Color c = b.getBackground();

      updateColor(c, e.getSource());
    }
  }
Ejemplo n.º 3
0
 @Override
 public void actionPerformed(java.awt.event.ActionEvent e) {
   try {
     PropertyEditor propEd = property.getPropertyEditor();
     propEd.setValue(property.getValue());
     final Component custEditor = propEd.getCustomEditor();
     Object[] options = buttons();
     DialogDescriptor descriptor =
         new DialogDescriptor(
             custEditor,
             (String) getValue(Action.NAME),
             true,
             options,
             DialogDescriptor.CANCEL_OPTION,
             DialogDescriptor.DEFAULT_ALIGN,
             HelpCtx.DEFAULT_HELP,
             (ActionEvent e1) -> {
               try {
                 String action = e1.getActionCommand();
                 switch (action) {
                   case OK_COMMAND:
                     Object value = property.getPropertyEditor().getValue();
                     property.setValue(value);
                     break;
                   case RESTORE_COMMAND:
                     property.restoreDefaultValue();
                     break;
                 }
                 dialog.dispose();
               } catch (Exception ex) {
                 NotifyDescriptor descriptor2 =
                     new NotifyDescriptor.Message(
                         NbBundle.getMessage(PropertyAction.class, "MSG_InvalidValue")); // NOI18N
                 DialogDisplayer.getDefault().notify(descriptor2);
               }
             });
     descriptor.setClosingOptions(new Object[0]);
     dialog = DialogDisplayer.getDefault().createDialog(descriptor);
     dialog.setVisible(true);
     dialog = null;
   } catch (Exception ex) {
     ErrorManager.getDefault().notify(ex);
   }
 }