java.awt.event.ActionEvent.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中java.awt.event.ActionEvent.<init>()方法的一些代码示例,展示了ActionEvent.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ActionEvent.<init>()方法的具体详情如下:
包路径:java.awt.event.ActionEvent
类名称:ActionEvent
方法名:<init>

ActionEvent.<init>介绍

[英]Constructs an ActionEvent object.

Note that passing in an invalid id results in unspecified behavior.
[中]构造一个ActionEvent对象。
请注意,传入无效的id会导致未指定的行为。

代码示例

代码示例来源:origin: stackoverflow.com

for(ActionListener a: buttonExample.getActionListeners()) {
  a.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, null) {
     //Nothing need go here, the actionPerformed method (with the
     //above arguments) will trigger the respective listener
  });
}

代码示例来源:origin: stanfordnlp/CoreNLP

@Override
 public void actionPerformed(ActionEvent e) {
  if (focusOwner == null)
   return;
  String action = e.getActionCommand();
  Action a = focusOwner.getActionMap().get(action);
  if (a != null) {
   a.actionPerformed(new ActionEvent(focusOwner,
     ActionEvent.ACTION_PERFORMED,
     null));
  }
 }
}

代码示例来源:origin: JetBrains/ideavim

public void actionPerformed(@NotNull ActionEvent e) {
  ExTextField target = (ExTextField)getTextComponent(e);
  final Action currentAction = target.getCurrentAction();
  if (currentAction != null) {
   currentAction.actionPerformed(e);
  }
  else {
   KeyStroke key = convert(e);
   if (key != null) {
    final char c = key.getKeyChar();
    if (c > 0) {
     ActionEvent event = new ActionEvent(e.getSource(), e.getID(), "" + c, e.getWhen(), e.getModifiers());
     super.actionPerformed(event);
     target.saveLastEntry();
    }
   }
   else {
    super.actionPerformed(e);
    target.saveLastEntry();
   }
  }
 }
}

代码示例来源:origin: org.netbeans.api/org-openide-dialogs

public void fireActionPerformed() {
    if (listner != null) {
      listner.actionPerformed(new ActionEvent(this, 0, ""));
    }
  }
}

代码示例来源:origin: magefree/mage

@Override
  public void mouseClicked(MouseEvent e) {
    int modelRow = TablesUtil.getSelectedModelRow(table);
    if (e.getClickCount() == 2 && modelRow != -1) {
      action.actionPerformed(new ActionEvent(table, ActionEvent.ACTION_PERFORMED, TablesUtil.getSearchIdFromTable(table, modelRow)));
    }
  }
});

代码示例来源:origin: nodebox/nodebox

/**
 * Send a ChangeEvent, whose source is this Slider, to
 * each listener.  This method method is called each time
 * a ChangeEvent is received from the model.
 *
 * @param menuKey The menu item key that was selected.
 * @see #addActionListener
 * @see javax.swing.event.EventListenerList
 */
protected void fireActionEvent(String menuKey) {
  ActionEvent actionEvent = new ActionEvent(this, 0, menuKey);
  Object[] listeners = listenerList.getListenerList();
  for (int i = listeners.length - 2; i >= 0; i -= 2) {
    if (listeners[i] == ActionListener.class) {
      ((ActionListener) listeners[i + 1]).actionPerformed(actionEvent);
    }
  }
}

代码示例来源:origin: ron190/jsql-injection

/**
 * Perform copy event on current table.
 */
public void copyTable() {
  ActionEvent nev = new ActionEvent(this.tableValues, ActionEvent.ACTION_PERFORMED, "copy");
  this.tableValues.getActionMap().get(nev.getActionCommand()).actionPerformed(nev);
}

代码示例来源:origin: org.netbeans.api/org-openide-dialogs

@Override
  public void actionPerformed( ActionEvent e ) {
    nd.setValue(option);
    if (buttonListener != null) {
      // #34485: some listeners expect that the action source is the option, not the button
      ActionEvent e2 = new ActionEvent(
          option, e.getID(), e.getActionCommand(), e.getWhen(), e.getModifiers()
        );
      buttonListener.actionPerformed(e2);
    }
    if ((closingOptions == null) || Arrays.asList(closingOptions).contains(option)) {
      haveFinalValue = true;
      setVisible(false);
    }
  }
}

代码示例来源:origin: ron190/jsql-injection

@Override
  public void actionPerformed(ActionEvent e) {
    ActionEvent copyEvent = new ActionEvent(
      JPopupMenuTable.this.table,
      ActionEvent.ACTION_PERFORMED,
      "copy"
    );
    JPopupMenuTable.this.table.getActionMap().get(copyEvent.getActionCommand()).actionPerformed(copyEvent);
  }
}

代码示例来源:origin: stackoverflow.com

actionCommand = model.getActionCommand();
ActionEvent ae = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, actionCommand);
for (int i = listeners.length-2; i>=0; i-=2) {
  if (listeners[i]== ActionListener.class) {
    ((ActionListener)listeners[i+1]).actionPerformed(ae);

代码示例来源:origin: magefree/mage

@Override
public void actionPerformed(ActionEvent e) {
  if (table.getRowCount() > 0 && table.getRowCount() >= table.getEditingRow() && table.getEditingRow() >= 0) {
    int row = table.convertRowIndexToModel(table.getEditingRow());
    fireEditingStopped();
    ActionEvent event = new ActionEvent(table, ActionEvent.ACTION_PERFORMED, TablesUtil.getSearchIdFromTable(table, row));
    action.actionPerformed(event);
  }
}

代码示例来源:origin: worstcase/gumshoe

private void notifyCloseListeners() {
    for(ActionListener listener : closeListeners) {
      listener.actionPerformed(new ActionEvent(this, 0, ""));
    }
  }
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Selects word based on a mouse event.
 */
private void selectWord(MouseEvent e) {
  if (selectedWordEvent != null &&
      selectedWordEvent.getX() == e.getX() &&
      selectedWordEvent.getY() == e.getY()) {
    // We've already the done selection for this.
    return;
  }
  Action a = null;
  RTextArea textArea = getTextArea();
  ActionMap map = textArea.getActionMap();
  if (map != null) {
    a = map.get(RTextAreaEditorKit.selectWordAction);
  }
  if (a == null) {
    if (selectWord == null) {
      selectWord = new RTextAreaEditorKit.SelectWordAction();
    }
    a = selectWord;
  }
  a.actionPerformed(new ActionEvent(textArea,
            ActionEvent.ACTION_PERFORMED,
            null, e.getWhen(), e.getModifiers()));
  selectedWordEvent = e;
}

代码示例来源:origin: net.imagej/imagej-ui-swing

@Override
  public void mouseClicked(MouseEvent event) {
    ActionListener action = getAction(event);
    if (action != null)
      action.actionPerformed(new ActionEvent(DiffView.this, 0, "action"));
  }
});

代码示例来源:origin: winder/Universal-G-Code-Sender

private void processEditingStopped()
  {
    newValue = table.getModel().getValueAt(row, column);

    //  The data has changed, invoke the supplied Action

    if (! newValue.equals(oldValue))
    {
      //  Make a copy of the data in case another cell starts editing
      //  while processing this change

      TableCellListener tcl = new TableCellListener(
        getTable(), getRow(), getColumn(), getOldValue(), getNewValue());

      ActionEvent event = new ActionEvent(
        tcl,
        ActionEvent.ACTION_PERFORMED,
        "");
      action.actionPerformed(event);
    }
  }
}

代码示例来源:origin: org.w3c.jigsaw/jigsaw

/**
 * fire a new ActionEvent and process it, if some listeners are listening
 */
protected void fireActionEvent() {
 if(actionListener != null) {
  ActionEvent ae = new ActionEvent(this,
           ActionEvent.ACTION_PERFORMED,
           command);
  actionListener.actionPerformed(ae);
 }
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * "Plays back" the last recorded macro in this text area.
 */
public synchronized void playbackLastMacro() {
  if (currentMacro!=null) {
    List<MacroRecord> macroRecords = currentMacro.getMacroRecords();
    if (!macroRecords.isEmpty()) {
      Action[] actions = getActions();
      undoManager.beginInternalAtomicEdit();
      try {
        for (MacroRecord record : macroRecords) {
          for (int i=0; i<actions.length; i++) {
            if ((actions[i] instanceof RecordableTextAction) &&
              record.id.equals(
              ((RecordableTextAction)actions[i]).getMacroID())) {
              actions[i].actionPerformed(
                new ActionEvent(this,
                      ActionEvent.ACTION_PERFORMED,
                      record.actionCommand));
              break;
            }
          }
        }
      } finally {
        undoManager.endInternalAtomicEdit();
      }
    }
  }
}

代码示例来源:origin: eu.mihosoft.vrl/vrl

private static void notifyActionListeners(String a) {
  for(ActionListener l : dialogActionListeners) {
    l.actionPerformed(new ActionEvent(VDialog.class, 0, a));
  }
}

代码示例来源:origin: ron190/jsql-injection

Action action = this.dndList.getActionMap().get(TransferHandler.getCopyAction().getValue(Action.NAME));
if (action != null) {
  action.actionPerformed(
    new ActionEvent(this.dndList, ActionEvent.ACTION_PERFORMED, null)
  );
Action action = this.dndList.getActionMap().get(TransferHandler.getCutAction().getValue(Action.NAME));
if (action != null) {
  action.actionPerformed(
    new ActionEvent(this.dndList, ActionEvent.ACTION_PERFORMED, null)
  );
Action action = this.dndList.getActionMap().get(TransferHandler.getPasteAction().getValue(Action.NAME));
if (action != null) {
  action.actionPerformed(
    new ActionEvent(this.dndList, ActionEvent.ACTION_PERFORMED, null)
  );

代码示例来源:origin: nativelibs4java/JNAerator

private synchronized void fireActionPerformed() {
  if (actionListeners == null) 
    return;
  
  ActionEvent a = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "");
  for (ActionListener l : actionListeners)
    l.actionPerformed(a);
}

相关文章