本文整理了Java中java.awt.event.KeyEvent.getModifiers()
方法的一些代码示例,展示了KeyEvent.getModifiers()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyEvent.getModifiers()
方法的具体详情如下:
包路径:java.awt.event.KeyEvent
类名称:KeyEvent
方法名:getModifiers
暂无
代码示例来源:origin: stackoverflow.com
/**
* Override the behaviour so that TAB key transfers the focus
* to the next focusable component.
*/
@Override
public void keyPressed(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_TAB) {
System.out.println(e.getModifiers());
if(e.getModifiers() > 0) a.transferFocusBackward();
else a.transferFocus();
e.consume();
}
}
代码示例来源:origin: nodebox/nodebox
public void keyReleased(KeyEvent e) {
Component c = SwingUtilities.getWindowAncestor(Viewer.this);
if (c instanceof FullScreenFrame) {
FullScreenFrame frame = (FullScreenFrame) c;
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
frame.close();
} else if (e.getKeyCode() == KeyEvent.VK_P) {
int metaMask = KeyEvent.META_MASK;
int metaShiftMask = KeyEvent.META_MASK | KeyEvent.SHIFT_MASK;
if (e.getModifiers() == metaMask)
frame.toggleAnimation();
else if (e.getModifiers() == metaShiftMask)
frame.rewindAnimation();
}
}
if (handle != null)
handle.keyReleased(e.getKeyCode(), e.getModifiersEx());
}
代码示例来源:origin: org.netbeans.api/org-openide-awt
@Override
public void keyTyped(KeyEvent e) {
int modifiers = e.getModifiers();
int keyCode = e.getKeyCode();
char c = e.getKeyChar();
//#43617 - don't eat + and -
//#98634 - and all its duplicates dont't react to space
if ((c == '+') || (c == '-') || (c==' ')) return; // NOI18N
if (((modifiers > 0) && (modifiers != KeyEvent.SHIFT_MASK)) || e.isActionKey()) {
return;
}
if (Character.isISOControl(c) ||
(keyCode == KeyEvent.VK_SHIFT) ||
(keyCode == KeyEvent.VK_ESCAPE)) return;
displaySearchField();
final KeyStroke stroke = KeyStroke.getKeyStrokeForEvent(e);
searchTextField.setText(String.valueOf(stroke.getKeyChar()));
e.consume();
}
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core
/**
* Check if an event matches the KeyStroke definition.
*
* @param e event
* @param k keystroke
* @return true if event matches the keystroke definition
*/
public static boolean matches(KeyEvent e, KeyStroke k){
final int modifiersEx = e.getModifiersEx() | e.getModifiers();// Hack to get full modifier value
return e.getKeyCode() == k.getKeyCode() && modifiersEx == k.getModifiers();
}
}
代码示例来源:origin: ron190/jsql-injection
if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER) {
this.terminal.getIsEdited()[0] = true;
keyEvent.consume();
} else if (keyEvent.getKeyCode() == KeyEvent.VK_UP) {
keyEvent.consume();
} else if (keyEvent.getKeyCode() == KeyEvent.VK_DOWN) {
keyEvent.consume();
keyEvent.getKeyCode() == KeyEvent.VK_A && (keyEvent.getModifiers() & InputEvent.CTRL_MASK) != 0 ||
keyEvent.getKeyCode() == KeyEvent.VK_DELETE && caretPosition == this.terminal.getDocument().getLength() ||
(keyEvent.getModifiers() & InputEvent.CTRL_MASK) != 0 && (keyEvent.getModifiers() & InputEvent.SHIFT_MASK) != 0 ||
keyEvent.getKeyCode() == KeyEvent.VK_PAGE_UP ||
keyEvent.getKeyCode() == KeyEvent.VK_PAGE_DOWN ||
keyEvent.consume();
} else if (keyEvent.getKeyCode() == KeyEvent.VK_C && (keyEvent.getModifiers() & InputEvent.CTRL_MASK) != 0) {
keyEvent.consume();
代码示例来源:origin: freeplane/freeplane
private boolean areEqual(KeyEvent e, KeyStroke currentAccelerator) {
return currentAccelerator != null
&& e.getKeyCode() == currentAccelerator.getKeyCode()
&& (e.getModifiers() | e.getModifiersEx()) == currentAccelerator.getModifiers();
}
代码示例来源:origin: stackoverflow.com
isCheatCode(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_W) {
int mods = e.getModifiers();
return (mods & InputEvent.ALT_MASK != 0)
&& mods & InputEvent.CTRL_MASK != 0;
}
return false;
}
代码示例来源:origin: ontop/ontop
@Override
public void keyPressed(KeyEvent e) {
if ((e.getModifiers() == KeyEvent.CTRL_MASK && e.getKeyCode() == KeyEvent.VK_ENTER)) {
cmdExecuteQueryActionPerformed(null);
}
}
@Override
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-modelutil
@Override
public void keyPressed(java.awt.event.KeyEvent evt) {
if (evt.getKeyCode() == KeyEvent.VK_ENTER && evt.getModifiers() == 0) {
openSelected();
}
}
});
代码示例来源:origin: ron190/jsql-injection
if (keyEvent.getKeyCode() == KeyEvent.VK_CONTROL) {
this.wasAltGraphPressed[0] = true;
&& keyEvent.getKeyCode() == (KeyEvent.VK_ALT & KeyEvent.VK_D)
keyEvent.getKeyCode() == KeyEvent.VK_ALT
&& keyEvent.getModifiers() == (InputEvent.ALT_MASK & KeyEvent.KEY_RELEASED)
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-highlight
@Override
public void keyReleased(KeyEvent e) {
int selected = rightList.getSelectedIndex();
if (e.getModifiers()==0 && e.getKeyCode()==KeyEvent.VK_SPACE && selected >= 0){
openElement(selected);
}
}
});
代码示例来源:origin: ontop/ontop
@Override
public void keyPressed(KeyEvent e) {
if (cmdInsertMapping.isEnabled() && (e.getModifiers() == KeyEvent.CTRL_MASK && e.getKeyCode() == KeyEvent.VK_ENTER)) {
cmdInsertMappingActionPerformed(null);
} else if ((e.getModifiers() == KeyEvent.CTRL_MASK && e.getKeyCode() == KeyEvent.VK_T)) {
cmdTestQueryActionPerformed(null);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-refactoring
@Override
public void keyPressed(KeyEvent e) {
if ( (e.getKeyCode() == KeyEvent.VK_ESCAPE && e.getModifiers() == 0)
|| (e.getKeyCode() == KeyEvent.VK_ENTER && e.getModifiers() == 0)) {
release();
e.consume();
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf
public void keyPressed(KeyEvent e) {
if ( (e.getKeyCode() == KeyEvent.VK_ESCAPE && e.getModifiers() == 0)
|| (e.getKeyCode() == KeyEvent.VK_ENTER && e.getModifiers() == 0)) {
release();
e.consume();
}
}
代码示例来源:origin: stackoverflow.com
textArea.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_C && (e.getModifiers() & KeyEvent.CTRL_MASK) != 0) {
Toolkit toolkit = Toolkit.getDefaultToolkit();
Clipboard clipboard = toolkit.getSystemClipboard();
CliboardString text = new CliboardString(textArea.getSelectedText(),"cp1250","Windows-1250");
clipboard.setContents(text, null);
e.consume();
}
}
});
代码示例来源:origin: org.fudaa.framework.ebli/ebli-common
public void keyPressed(final KeyEvent _e) {
final int mod = _e.getModifiers();
if (KeyEvent.VK_A == _e.getKeyCode() && (mod & InputEvent.ALT_MASK) == InputEvent.ALT_MASK) {
changeDialogType();
}
}
代码示例来源:origin: org.tentackle/tentackle-swing
private void performFocusLost () {
transferFocusByEnter = lastKeyEvent != null &&
(lastKeyEvent.getKeyCode() == KeyEvent.VK_ENTER || lastKeyEvent.getKeyCode() == KeyEvent.VK_TAB) &&
(lastKeyEvent.getModifiers() == 0 || lastKeyEvent.getModifiers() == KeyEvent.SHIFT_MASK);
performWrapEvent();
showTooltip(null);
lastKeyEvent = null;
}
代码示例来源:origin: ontop/ontop
private void txtQueryEditorKeyPressed(java.awt.event.KeyEvent evt) {// GEN-FIRST:event_txtQueryEditorKeyPressed
// If users typed CTRL+E
if ((evt.getKeyCode() == KeyEvent.VK_E) && ((evt.getModifiers() & KeyEvent.CTRL_MASK) != 0)) {
executeQuery();
txtClassUriTemplate.requestFocus();
}
}// GEN-LAST:event_txtQueryEditorKeyPressed
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf
private void jList1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jList1KeyPressed
// TODO add your handling code here:
if (evt.getKeyCode() == KeyEvent.VK_ENTER && evt.getModifiers() == 0) {
openSelected();
}
}//GEN-LAST:event_jList1KeyPressed
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-beans
private void jList1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jList1KeyPressed
if (evt.getKeyCode() == KeyEvent.VK_ENTER && evt.getModifiers() == 0) {
openSelected();
}
}//GEN-LAST:event_jList1KeyPressed
内容来源于网络,如有侵权,请联系作者删除!