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

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

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

ActionEvent.getModifiers介绍

[英]Returns the modifier keys held down during this action event.
[中]返回在此操作事件期间按住的修改器键。

代码示例

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

@Nullable
public static KeyStroke convert(@NotNull ActionEvent event) {
 String cmd = event.getActionCommand();
 int mods = event.getModifiers();
 if (cmd != null && cmd.length() > 0) {
  char ch = cmd.charAt(0);
  if (ch < ' ') {
   if (mods == KeyEvent.CTRL_MASK) {
    return KeyStroke.getKeyStroke(KeyEvent.VK_A + ch - 1, mods);
   }
  }
  else {
   return KeyStroke.getKeyStroke(new Character(ch), mods);
  }
 }
 return null;
}

代码示例来源:origin: deathmarine/Luyten

@Override
  public void actionPerformed(ActionEvent e) {
    JTabbedPane house = mainWindow.getModel().house;
    
    if (e.getModifiers() != 2 || house.getTabCount() == 0)
      mainWindow.onCloseFileMenu();
    else {
      mainWindow.getModel().closeOpenTab(house.getSelectedIndex());
    }
  }
});

代码示例来源:origin: groovy/groovy-core

public void actionPerformed(ActionEvent ae) {
    lastAction = FIND_ACTION_COMMAND;
    findReplaceCount = 0;
    if (FIND_REPLACE_DIALOG.isVisible() &&
        FIND_REPLACE_DIALOG.getTitle().equals(FIND_ACTION_COMMAND)) {
    }
    int pos = textComponent.getSelectedText() == null ?
        textComponent.getCaretPosition() :
        textComponent.getSelectionStart();
    boolean reverse = (ae.getModifiers() & ActionEvent.SHIFT_MASK) != 0;
    pos = findNext(reverse, pos);
    if (pos > -1) {
      String pattern = (String) FIND_FIELD.getSelectedItem();
      textComponent.select(pos, pos + pattern.length());
      findReplaceCount = 1;
    }
    setListStrings();
    fireTextEvent();
  }
}

代码示例来源: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: magefree/mage

private void tbBlackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbBlackActionPerformed
  filterCardsColor(evt.getModifiers(), evt.getActionCommand());
}//GEN-LAST:event_tbBlackActionPerformed

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

private void tbInstantsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbInstantsActionPerformed
  filterCardsType(evt.getModifiers(), evt.getActionCommand());
}//GEN-LAST:event_tbInstantsActionPerformed

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

private void tbPlaneswalkersActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbPlaneswalkersActionPerformed
  filterCardsType(evt.getModifiers(), evt.getActionCommand());
}//GEN-LAST:event_tbPlaneswalkersActionPerformed

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

private void tbSpecialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbSpecialActionPerformed
  filterCardsRarity(evt.getModifiers(), evt.getActionCommand());
}//GEN-LAST:event_tbSpecialActionPerformed

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

private void tbGreenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbGreenActionPerformed
  filterCardsColor(evt.getModifiers(), evt.getActionCommand());
}//GEN-LAST:event_tbGreenActionPerformed

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

private void tbBlueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbBlueActionPerformed
  filterCardsColor(evt.getModifiers(), evt.getActionCommand());
}//GEN-LAST:event_tbBlueActionPerformed

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

private void tbCommonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbCommonActionPerformed
  filterCardsRarity(evt.getModifiers(), evt.getActionCommand());
}//GEN-LAST:event_tbCommonActionPerformed

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

private void tbRareActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbRareActionPerformed
  filterCardsRarity(evt.getModifiers(), evt.getActionCommand());
}//GEN-LAST:event_tbRareActionPerformed

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

private void tbWhiteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbWhiteActionPerformed
  filterCardsColor(evt.getModifiers(), evt.getActionCommand());
}//GEN-LAST:event_tbWhiteActionPerformed

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

private void tbColorlessActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbColorlessActionPerformed
  filterCardsColor(evt.getModifiers(), evt.getActionCommand());
}//GEN-LAST:event_tbColorlessActionPerformed

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

private void tbCreaturesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbCreaturesActionPerformed
  filterCardsType(evt.getModifiers(), evt.getActionCommand());
}//GEN-LAST:event_tbCreaturesActionPerformed

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

private void tbArifiactsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbArifiactsActionPerformed
  filterCardsType(evt.getModifiers(), evt.getActionCommand());
}//GEN-LAST:event_tbArifiactsActionPerformed

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

private void tbSorceriesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbSorceriesActionPerformed
  filterCardsType(evt.getModifiers(), evt.getActionCommand());
}//GEN-LAST:event_tbSorceriesActionPerformed

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

private void tbEnchantmentsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbEnchantmentsActionPerformed
  filterCardsType(evt.getModifiers(), evt.getActionCommand());
}//GEN-LAST:event_tbEnchantmentsActionPerformed

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

private void tbLandActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbLandActionPerformed
  filterCardsType(evt.getModifiers(), evt.getActionCommand());
}//GEN-LAST:event_tbLandActionPerformed

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

private void tbUncommonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbUncommonActionPerformed
  filterCardsRarity(evt.getModifiers(), evt.getActionCommand());
}//GEN-LAST:event_tbUncommonActionPerformed

相关文章