当前位置: 首页>>代码示例>>Java>>正文


Java KeyEvent.VK_CONTROL属性代码示例

本文整理汇总了Java中java.awt.event.KeyEvent.VK_CONTROL属性的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.VK_CONTROL属性的具体用法?Java KeyEvent.VK_CONTROL怎么用?Java KeyEvent.VK_CONTROL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.awt.event.KeyEvent的用法示例。


在下文中一共展示了KeyEvent.VK_CONTROL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: keyPressed

public void keyPressed(KeyEvent e) {
    int keycode = e.getKeyCode();
    switch(keycode) {
    case KeyEvent.VK_CONTROL:
        _control = true;
        break;
    case KeyEvent.VK_Z:
        if (_control) {
            undo();
        }
        break;
    case KeyEvent.VK_Y:
        if (_control) {
            redo();
        }
        break;
    default:
        // None
    }
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:20,代码来源:EditablePlot.java

示例2: keyPressed

@Override
public void keyPressed(KeyEvent e) {

    keyPressReceived = true;

    int code = e.getKeyCode();

    assertEQ(code, keyCode, "wrong key code");

    int mask = 0;

    if (code == KeyEvent.VK_SHIFT) {
        mask = InputEvent.SHIFT_MASK;
    } else if (code == KeyEvent.VK_CONTROL) {
        mask = InputEvent.CTRL_MASK;
    } else if (code == KeyEvent.VK_ALT) {
        mask = InputEvent.ALT_MASK;
    } else if (code == KeyEvent.VK_META) {
        mask = InputEvent.META_MASK;
    }

    int mod = e.getModifiers() & mask;
    assertEQ(mod, mask, "invalid key mask");

    synchronized (lock) { lock.notifyAll(); }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:KeyMaskTest.java

示例3: keyPressed

@Override
public void keyPressed(Canvas canvas, KeyEvent e) {
	int code = e.getKeyCode();
	if (active && (code == KeyEvent.VK_SHIFT || code == KeyEvent.VK_ALT || code == KeyEvent.VK_CONTROL)) {
		updateMouse(canvas, lastMouseX, lastMouseY, e.getModifiersEx());
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:7,代码来源:RectangularTool.java

示例4: process

protected void process(KeyEvent e) {
  // If we've consumed a KeyPressed event,
  // then automatically consume any following KeyTyped event
  // resulting from the same keypress
  // This prevents echoing characters to the Chat area if they're keycommand for selected pieces
  if (lastConsumedEvent != null
      && lastConsumedEvent.getWhen() == e.getWhen()) {
    e.consume();
  }
  else {
    lastConsumedEvent = null;
  }
  final int c = e.getKeyCode();
  // Don't pass SHIFT or CONTROL only to counters
  if (!e.isConsumed() && c != KeyEvent.VK_SHIFT && c != KeyEvent.VK_CONTROL) {
    Command comm = KeyBuffer.getBuffer().keyCommand
        (KeyStroke.getKeyStrokeForEvent(e));
    if (comm != null && !comm.isNull()) {
      GameModule.getGameModule().sendAndLog(comm);
      e.consume();
      lastConsumedEvent = e;
    }
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:24,代码来源:ForwardToKeyBuffer.java

示例5: getKeyEvent

public int getKeyEvent(String key) {
    switch (key.toUpperCase()) {
        case "TAB":
            return KeyEvent.VK_TAB;
        case "ENTER":
            return KeyEvent.VK_ENTER;
        case "SHIFT":
            return KeyEvent.VK_SHIFT;
        case "CTRL":
            return KeyEvent.VK_CONTROL;
        case "ALT":
            return KeyEvent.VK_ALT;
        case "START":
            return KeyEvent.VK_WINDOWS;
        case "DELETE":
            return KeyEvent.VK_DELETE;
        case "BACKSPACE":
            return KeyEvent.VK_BACK_SPACE;
        case "HOME":
            return KeyEvent.VK_HOME;
        case "PAGE_UP":
        case "PAGEUP":
            return KeyEvent.VK_PAGE_UP;
        case "PAGE_DOWN":
        case "PAGEDOWN":
            return KeyEvent.VK_PAGE_DOWN;
        case "UP":
            return KeyEvent.VK_UP;
        case "DOWN":
            return KeyEvent.VK_DOWN;
        case "LEFT":
            return KeyEvent.VK_LEFT;
        case "RIGHT":
            return KeyEvent.VK_RIGHT;
        default:
            return KeyEvent.VK_ESCAPE;
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:38,代码来源:ImageCommand.java

示例6: keyPressed

@Override
public void keyPressed(Canvas canvas, KeyEvent e) {
	int code = e.getKeyCode();
	if (active && mouseDown && (code == KeyEvent.VK_SHIFT || code == KeyEvent.VK_CONTROL)) {
		updateMouse(canvas, lastMouseX, lastMouseY, e.getModifiersEx());
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:7,代码来源:PolyTool.java

示例7: getKeyStrokeAsText

static String getKeyStrokeAsText (KeyStroke keyStroke) {
    if (keyStroke == null)
        return "";
    int modifiers = keyStroke.getModifiers ();
    StringBuffer sb = new StringBuffer ();
    if ((modifiers & InputEvent.CTRL_DOWN_MASK) > 0)
        sb.append ("Ctrl+");
    if ((modifiers & InputEvent.ALT_DOWN_MASK) > 0)
        sb.append ("Alt+");
    if ((modifiers & InputEvent.SHIFT_DOWN_MASK) > 0)
        sb.append ("Shift+");
    if ((modifiers & InputEvent.META_DOWN_MASK) > 0)
        if (Utilities.isMac()) {
            // Mac cloverleaf symbol
            sb.append ("\u2318+");
        } else if (isSolaris()) {
            // Sun meta symbol
            sb.append ("\u25C6+");
        } else {
            sb.append ("Meta+");
        }
    if (keyStroke.getKeyCode () != KeyEvent.VK_SHIFT &&
        keyStroke.getKeyCode () != KeyEvent.VK_CONTROL &&
        keyStroke.getKeyCode () != KeyEvent.VK_META &&
        keyStroke.getKeyCode () != KeyEvent.VK_ALT &&
        keyStroke.getKeyCode () != KeyEvent.VK_ALT_GRAPH
    )
        sb.append (Utilities.keyToString (
            KeyStroke.getKeyStroke (keyStroke.getKeyCode (), 0)
        ));
    return sb.toString ();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:SearchResultRender.java

示例8: ModifierRobotKeyTest

public ModifierRobotKeyTest() throws Exception {
    modifierKeys =  new int[4];
    modifierKeys[0] = KeyEvent.VK_SHIFT;
    modifierKeys[1] = KeyEvent.VK_CONTROL;
    modifierKeys[2] = KeyEvent.VK_ALT;
    modifierKeys[3] = KeyEvent.VK_ALT_GRAPH;

    inputMasks = new int[4];
    inputMasks[0] =  InputEvent.SHIFT_MASK;
    inputMasks[1] =  InputEvent.CTRL_MASK;
    inputMasks[2] =  InputEvent.ALT_MASK;
    inputMasks[3] =  InputEvent.ALT_GRAPH_MASK;

    modifierStatus = new boolean[modifierKeys.length];

    textKeys = new int[2];
    textKeys[0] = KeyEvent.VK_A;

    String os = System.getProperty("os.name").toLowerCase();

    if (os.contains("solaris") || os.contains("sunos"))
        textKeys[1] = KeyEvent.VK_S;
    else if (os.contains("os x"))
        textKeys[1] = KeyEvent.VK_K;
    else
        textKeys[1] = KeyEvent.VK_I;

    textStatus = new boolean[textKeys.length];

    EventQueue.invokeAndWait( () -> { initializeGUI(); });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:ModifierRobotKeyTest.java

示例9: update

public void update() {
	up = keys[KeyEvent.VK_UP] || keys[KeyEvent.VK_W];		
	down = keys[KeyEvent.VK_DOWN] || keys[KeyEvent.VK_S];		
	left = keys[KeyEvent.VK_LEFT] || keys[KeyEvent.VK_A];
	right = keys[KeyEvent.VK_RIGHT] || keys[KeyEvent.VK_D];
	
	dash = keys[KeyEvent.VK_CONTROL];
}
 
开发者ID:Samanimkr,项目名称:KingdomKing,代码行数:8,代码来源:Keyboard.java

示例10: updateFilter

private void updateFilter(KeyEvent e) {
	String filterText = getText();
	if ((filterText == null) || (filterText.length() == 0)) {
		if ((e == null)
				|| ((e.getKeyCode() != KeyEvent.VK_BACK_SPACE) && (e.getKeyCode() != KeyEvent.VK_DELETE)
						&& (e.getKeyCode() != KeyEvent.VK_SHIFT) && (e.getKeyCode() != KeyEvent.VK_ALT)
						&& (e.getKeyCode() != KeyEvent.VK_ALT_GRAPH) && (e.getKeyCode() != KeyEvent.VK_CONTROL)
						&& (e.getKeyCode() != KeyEvent.VK_META) && (!e.isActionKey()))) {
			setText(null);
		}
	}
	for (FilterListener l : filterListeners) {
		l.valueChanged(filterText);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:15,代码来源:FilterTextField.java

示例11: keyReleased

public void keyReleased(KeyEvent e) {
    int keycode = e.getKeyCode();
    switch(keycode) {
    case KeyEvent.VK_CONTROL:
        _control = false;
        break;
    case KeyEvent.VK_SHIFT:
        _shift = false;
        break;
    default:
        // None
    }
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:13,代码来源:PlotBox.java

示例12: getModifier

private int getModifier(int keycode) {
    switch (keycode) {
    case KeyEvent.VK_SHIFT:
        return InputEvent.SHIFT_MASK;
    case KeyEvent.VK_CONTROL:
        return InputEvent.CTRL_MASK;
    case KeyEvent.VK_ALT:
        return InputEvent.ALT_MASK;
    case KeyEvent.VK_META:
        return InputEvent.META_MASK;
    default:
        throw new RuntimeException(OSUtils.keyEventGetKeyText(keycode) + " is not a valid modifier");
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:14,代码来源:KeyStrokeParser.java

示例13: recordRawKeyEvent

@Override public void recordRawKeyEvent(RComponent r, KeyEvent e) {
    JSONObject event = new JSONObject();
    event.put("type", "key_raw");
    int keyCode = e.getKeyCode();
    if (keyCode == KeyEvent.VK_META || keyCode == KeyEvent.VK_SHIFT || keyCode == KeyEvent.VK_ALT
            || keyCode == KeyEvent.VK_CONTROL) {
        return;
    }
    if ((e.isActionKey() || e.isControlDown() || e.isMetaDown() || e.isAltDown()) && e.getID() == KeyEvent.KEY_PRESSED) {
        String mtext = buildModifiersText(e);
        event.put("modifiersEx", mtext);
        KeysMap keysMap = KeysMap.findMap(e.getKeyCode());
        if (keysMap == KeysMap.NULL) {
            return;
        }
        String keyText;
        if (keysMap == null) {
            keyText = KeyEvent.getKeyText(e.getKeyCode());
        } else {
            keyText = keysMap.toString();
        }
        event.put("keyCode", keyText);
    } else if (e.getID() == KeyEvent.KEY_TYPED && !e.isControlDown()) {
        if (Character.isISOControl(e.getKeyChar()) && hasMapping(e.getKeyChar())) {
            event.put("keyChar", getMapping(e.getKeyChar()));
        } else {
            event.put("keyChar", "" + e.getKeyChar());
        }
    } else {
        return;
    }
    recordEvent(r, event);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:33,代码来源:WSRecorder.java

示例14: keyPressed

public void keyPressed(KeyEvent e) {
  switch (e.getKeyCode()) {
    case KeyEvent.VK_DELETE:
    case KeyEvent.VK_BACK_SPACE:
      setValue(null);
      break;
    case KeyEvent.VK_SHIFT:
    case KeyEvent.VK_CONTROL:
    case KeyEvent.VK_META:
    case KeyEvent.VK_ALT:
      break;
    default:
      setValue(KeyStroke.getKeyStrokeForEvent(e));
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:15,代码来源:HotKeyConfigurer.java

示例15: keyPressed

@Override
public void keyPressed(Canvas canvas, KeyEvent e) {
	int code = e.getKeyCode();
	if (mouseDown && (code == KeyEvent.VK_SHIFT || code == KeyEvent.VK_CONTROL || code == KeyEvent.VK_ALT)) {
		updateMouse(canvas, lastMouseX, lastMouseY, e.getModifiersEx());
		repaintArea(canvas);
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:8,代码来源:CurveTool.java


注:本文中的java.awt.event.KeyEvent.VK_CONTROL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。