本文整理汇总了Java中com.jogamp.newt.event.KeyEvent.VK_SHIFT属性的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.VK_SHIFT属性的具体用法?Java KeyEvent.VK_SHIFT怎么用?Java KeyEvent.VK_SHIFT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.jogamp.newt.event.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.VK_SHIFT属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertToNiftyKeyCode
public int convertToNiftyKeyCode(int key_code, int location) {
// manually map positioned keys
// Note: currently JOGL does not separate between left and right keys here so we map everything to left for now
switch (key_code) {
case KeyEvent.VK_ALT: // fall through
return KeyboardInputEvent.KEY_LMENU;
case KeyEvent.VK_WINDOWS:
case KeyEvent.VK_META:
return KeyboardInputEvent.KEY_LMETA;
case KeyEvent.VK_SHIFT:
return KeyboardInputEvent.KEY_LSHIFT;
case KeyEvent.VK_CONTROL:
return KeyboardInputEvent.KEY_LCONTROL;
default:
return KEY_MAP[key_code];
}
}
示例2: keyReleased
@Override
public void keyReleased(KeyEvent e) {
int keyCode = e.getKeyCode();
synchronized (this.keys) {
if (this.keys.containsKey(keyCode)) {
if (keyCode == KeyEvent.VK_SHIFT) {
this.keys.get(keyCode).reset();
} else {
this.keys.get(keyCode).release();
}
}
}
// e.consume();
}
示例3: keyReleased
@Override
public void keyReleased(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_SHIFT) {
ui.getContext().addTask(c -> {
completeAreaInConstruction();
return null;
});
}
}
示例4: handleSelection
private void handleSelection(KeyEvent e) {
if (e.isControlDown()) {
if (e.getKeyCode() == KeyEvent.VK_C) {
if (isAnythingSelected()) {
clipBoard = getSelectedLines();
}
} else if (e.getKeyCode() == KeyEvent.VK_X) {
if (isAnythingSelected()) {
clipBoard = getSelectedLines();
deleteSection(selectionLineStartPosition, selectionLineStopPosition, selectionCursorStartPosition,
selectionCursorStopPosition);
}
} else if (e.getKeyCode() == KeyEvent.VK_V) {
pasteClipboard();
}
}
if (e.getKeyCode() == KeyEvent.VK_SHIFT) {
if (!isAnythingSelected()) {
selectionCursorStartPosition = cursorPosition;
selectionLineStartPosition = linePosition;
}
} else if (e.isShiftDown() && isMovementKey(e)) {
selectionCursorStopPosition = cursorPosition;
selectionLineStopPosition = linePosition;
} else if (e.getKeyCode() != KeyEvent.VK_CONTROL && !(e.isControlDown() && e.getKeyCode() == KeyEvent.VK_C)) {
selectionCursorStartPosition = cursorPosition;
selectionLineStartPosition = linePosition;
selectionCursorStopPosition = cursorPosition;
selectionLineStopPosition = linePosition;
}
}
示例5: keyPressed
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_SHIFT) {
activate(true);
}
}
示例6: keyReleased
@Override
public void keyReleased(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_SHIFT) {
deactivate(false);
}
}
示例7: InputHandler
/**
* Initializes the inputs and sets up a {@code Robot} that controls the mouse.
* @param c
*/
public InputHandler(Controller c) {
this.c = c;
GLWindow win = c.getWindow();
try {
robot = new Robot();
} catch (AWTException e) {
throw new RuntimeException("The program will not function properly with the current permissions");
}
win.addKeyListener(this);
win.addMouseListener(this);
focused = false;
mouseSensitivity = 1.0/45/200;
//Initialize keys
keyCode = new int[NUM_KEYS];
keyCode[0] = KeyEvent.VK_W;
keyCode[1] = KeyEvent.VK_S;
keyCode[2] = KeyEvent.VK_A;
keyCode[3] = KeyEvent.VK_D;
keyCode[4] = KeyEvent.VK_SHIFT;
keyCode[5] = KeyEvent.VK_Q;
keyCode[6] = KeyEvent.VK_E;
keyCode[7] = KeyEvent.VK_1;
keyCode[8] = KeyEvent.VK_2;
keyCode[9] = KeyEvent.VK_3;
keyCode[10] = KeyEvent.VK_4;
keyCode[11] = KeyEvent.VK_V;
keyCode[12] = KeyEvent.VK_SPACE;
keyCode[13] = KeyEvent.VK_R;
keyCode[14] = KeyEvent.VK_DELETE;
keyCode[15] = KeyEvent.VK_EQUALS;
keyCode[16] = KeyEvent.VK_MINUS;
keyCode[17] = KeyEvent.VK_P;
keyCode[18] = KeyEvent.VK_O;
keyCode[19] = KeyEvent.VK_5;
keyCode[20] = KeyEvent.VK_6;
keyCode[21] = KeyEvent.VK_CONTROL;
keyCode[22] = KeyEvent.VK_F1;
keyCode[23] = KeyEvent.VK_F2;
mouseButton = new int[NUM_MOUSE_BUTTONS];
mouseButton[0] = MouseEvent.BUTTON1;
mouseButton[1] = MouseEvent.BUTTON3;
//Initialize key and mouse control variables.
keyDown = new boolean[NUM_KEYS];
keyCanceled = new boolean[NUM_KEYS];
keyPressed = new boolean[NUM_KEYS];
keyHelper = new boolean[NUM_KEYS];
mouseDown = new boolean[NUM_MOUSE_BUTTONS];
mouseCanceled = new boolean[NUM_MOUSE_BUTTONS];
mousePressed = new boolean[NUM_MOUSE_BUTTONS];
mouseHelper = new boolean[NUM_MOUSE_BUTTONS];
for (int i=0; i<NUM_KEYS; i++) {
keyDown[i] = false;
keyCanceled[i] = false;
keyPressed[i] = false;
keyHelper[i] = false;
}
for (int i=0; i<NUM_MOUSE_BUTTONS; i++) {
mouseDown[i] = false;
mouseCanceled[i] = false;
mousePressed[i] = false;
mouseHelper[i] = false;
}
}