本文整理汇总了Java中java.awt.event.KeyEvent.VK_RIGHT属性的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.VK_RIGHT属性的具体用法?Java KeyEvent.VK_RIGHT怎么用?Java KeyEvent.VK_RIGHT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.event.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.VK_RIGHT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: keyPressed
@Override
public void keyPressed(KeyEvent ke) {
int key = ke.getKeyCode();
if (key == KeyEvent.VK_UP) {
// projectionModificationBegin();
bDragging = true;
dragAnim.animWithVelocity(0, DragAnim.MAX_VELOCITY*.7);
} else if (key == KeyEvent.VK_DOWN) {
// projectionModificationBegin();
bDragging = true;
dragAnim.animWithVelocity(0, -DragAnim.MAX_VELOCITY*.7);
} else if (key == KeyEvent.VK_LEFT) {
// projectionModificationBegin();
bDragging = true;
dragAnim.animWithVelocity(DragAnim.MAX_VELOCITY*.7,0);
} else if (key == KeyEvent.VK_RIGHT) {
// projectionModificationBegin();
dragAnim.animWithVelocity(-DragAnim.MAX_VELOCITY*.7,0);
}
}
示例2: keyReleased
@Override
synchronized public void keyReleased(int keycode) {
switch (keycode)
{
case KeyEvent.VK_UP:
up = false;
break;
case KeyEvent.VK_DOWN:
down = false;
break;
case KeyEvent.VK_LEFT:
left = false;
break;
case KeyEvent.VK_RIGHT:
right = false;
break;
case KeyEvent.VK_SPACE:
space = false;
break;
default:
break;
}
}
示例3: processKeyEvent
protected void processKeyEvent(KeyEvent event) {
if (event.getID() == KeyEvent.KEY_RELEASED) {
int row = getSelectedRow();
if (row != -1) {
if (event.getKeyCode() == KeyEvent.VK_LEFT) {
if (treeRenderer.isExpanded(row)) {
treeRenderer.collapseRow(row);
} else {
int parentRow = treeRenderer.getRowForPath(treeRenderer.getPathForRow(row).getParentPath());
treeRenderer.collapseRow(parentRow);
getSelectionModel().setSelectionInterval(parentRow, parentRow);
}
event.consume();
return;
}
if (event.getKeyCode() == KeyEvent.VK_RIGHT) {
if (treeRenderer.isCollapsed(row)) {
treeRenderer.expandRow(row);
}
event.consume();
return;
}
}
}
super.processKeyEvent(event);
}
示例4: keyPressed
public void keyPressed(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_UP:
adjustY(-1, e);
break;
case KeyEvent.VK_DOWN:
adjustY(1, e);
break;
case KeyEvent.VK_LEFT:
adjustX(-1, e);
break;
case KeyEvent.VK_RIGHT:
adjustX(1, e);
break;
default :
if (myPiece != null) {
myPiece.keyEvent(KeyStroke.getKeyStrokeForEvent(e));
}
break;
}
updateDisplay();
repaint();
e.consume();
}
示例5: execute
/**
* execute
* called by an element and use the code of the last key pressed to use the specific method to move the element
* */
@Override
public void execute() {
switch (this.lastKey){
case KeyEvent.VK_UP:
this.element.goUp();
break;
case KeyEvent.VK_DOWN:
this.element.goDown();
break;
case KeyEvent.VK_LEFT:
this.element.goLeft();
break;
case KeyEvent.VK_RIGHT:
this.element.goRight();
break;
default:
this.element.goRest();
}
}
示例6: keyPressed
public void keyPressed(KeyEvent e) {
if( e.getKeyCode() == KeyEvent.VK_DOWN ) {
master.xlateDown();
master.fastRefresh();
}
if( e.getKeyCode() == KeyEvent.VK_UP ) {
master.xlateUp();
master.fastRefresh();
}
if( e.getKeyCode() == KeyEvent.VK_LEFT ) {
master.xlateLeft();
master.fastRefresh();
}
if( e.getKeyCode() == KeyEvent.VK_RIGHT ) {
master.xlateRight();
master.fastRefresh();
}
}
示例7: keyPressed
@Override
public void keyPressed(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_DOWN) {
selectOffsetMenuItem(+1);
}
if(e.getKeyCode() == KeyEvent.VK_UP) {
selectOffsetMenuItem(-1);
}
if(e.getKeyCode() == KeyEvent.VK_LEFT) {
selectOffsetMenu(-1);
}
if(e.getKeyCode() == KeyEvent.VK_RIGHT) {
selectOffsetMenu(+1);
}
if(e.getKeyCode() == KeyEvent.VK_SPACE) {
startEditing();
}
// #116961: start inplace editing when F2 key is pressed on a menu
if(e.getKeyCode() == KeyEvent.VK_F2) {
startEditing();
}
//we aren't getting tabs for some reason
if(e.getKeyCode() == KeyEvent.VK_A) {
if(e.isShiftDown()) {
selectNextMenuItem(-1);
} else {
selectNextMenuItem(+1);
}
}
}
示例8: keyPressed
public void keyPressed(KeyEvent e) {
if (e.isConsumed()) return;
int dx;
int dy;
if (Boolean.TRUE.equals(
GameModule.getGameModule().getPrefs().getValue(USE_ARROWS))) {
switch (e.getKeyCode()) {
case KeyEvent.VK_UP: dx = 0; dy = -1; break;
case KeyEvent.VK_DOWN: dx = 0; dy = 1; break;
case KeyEvent.VK_RIGHT: dx = 1; dy = 0; break;
case KeyEvent.VK_LEFT: dx = -1; dy = 0; break;
default: return;
}
}
else {
switch (e.getKeyCode()) {
case KeyEvent.VK_NUMPAD1: dx = -1; dy = 1; noEcho = '1'; break;
case KeyEvent.VK_NUMPAD2: dx = 0; dy = 1; noEcho = '2'; break;
case KeyEvent.VK_NUMPAD3: dx = 1; dy = 1; noEcho = '3'; break;
case KeyEvent.VK_NUMPAD4: dx = -1; dy = 0; noEcho = '4'; break;
case KeyEvent.VK_NUMPAD6: dx = 1; dy = 0; noEcho = '6'; break;
case KeyEvent.VK_NUMPAD7: dx = -1; dy = -1; noEcho = '7'; break;
case KeyEvent.VK_NUMPAD8: dx = 0; dy = -1; noEcho = '8'; break;
case KeyEvent.VK_NUMPAD9: dx = 1; dy = -1; noEcho = '9'; break;
default: return;
}
}
map.scroll(dx * xStep, dy * yStep);
e.consume();
}
示例9: isCompletionKey
private boolean isCompletionKey (int keyCode, JTextField textField) {
if (keyCode == KeyEvent.VK_ENTER || keyCode == KeyEvent.VK_TAB) {
return true;
}
if (keyCode == KeyEvent.VK_RIGHT &&
(textField.getCaretPosition() >= (textField.getDocument().getLength() - 1))) {
return true;
}
return false;
}
示例10: keyPressed
@Override
public void keyPressed(KeyEvent evt) {
showPopupCompletion = true;
int keyCode = evt.getKeyCode();
// #105801: completionPopup might not be ready when updateCompletions not called (empty text field)
if (completionPopup != null && !completionPopup.isVisible()) {
if (keyCode == KeyEvent.VK_ENTER) {
File file = getFileChooser().getFileSystemView().createFileObject(filenameTextField.getText());
if(file.exists() && file.isDirectory()) {
setSelected(new File[] {file});
fileChooser.approveSelection();
if (file.getParentFile() == null) {
// this will hopefully prevent popup to take inappropriate action
evt.consume();
}
}
}
if ((keyCode == KeyEvent.VK_TAB || keyCode == KeyEvent.VK_DOWN) ||
(keyCode == KeyEvent.VK_RIGHT &&
(filenameTextField.getCaretPosition() >= (filenameTextField.getDocument().getLength() - 1)))) {
updateCompletions();
}
}
if(filenameTextField.isFocusOwner() &&
(completionPopup == null || !completionPopup.isVisible()) &&
keyCode == KeyEvent.VK_ESCAPE) {
fileChooser.cancelSelection();
}
}
示例11: 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;
}
}
示例12: keyReleased
public void keyReleased(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_R:
Controller.removeAllExceptNotList();
InternerLvLcreator.internerLvlControl();
break;
case KeyEvent.VK_RIGHT:
imagePath = stehenRechtsBild;
velX = 0;
init = true;
w.stopSound();
break;
case KeyEvent.VK_LEFT:
imagePath = stehenLinksBild;
velX = 0;
init = true;
w.stopSound();
break;
case KeyEvent.VK_SPACE:
if (!nachRechtsGucken) {
imagePath = fallenLinksBild;
} else {
imagePath = fallenRechtsBild;
}
sprungkraft = 0;
break;
}
}
示例13: keySet
public static void keySet(int i, boolean b) {
if(i == KeyEvent.VK_UP) keyState[UP] = b;
else if(i == KeyEvent.VK_LEFT) keyState[LEFT] = b;
else if(i == KeyEvent.VK_DOWN) keyState[DOWN] = b;
else if(i == KeyEvent.VK_RIGHT) keyState[RIGHT] = b;
else if(i == KeyEvent.VK_W) keyState[BUTTON1] = b;
else if(i == KeyEvent.VK_E) keyState[BUTTON2] = b;
else if(i == KeyEvent.VK_R) keyState[BUTTON3] = b;
else if(i == KeyEvent.VK_F) keyState[BUTTON4] = b;
else if(i == KeyEvent.VK_ENTER) keyState[ENTER] = b;
else if(i == KeyEvent.VK_ESCAPE) keyState[ESCAPE] = b;
}
示例14: dispatchEvent
/**
* This is the input method's main routine. The composed text is stored
* in buffer.
*/
public void dispatchEvent(AWTEvent event) {
// This input method handles KeyEvent only.
if (!(event instanceof KeyEvent)) {
return;
}
KeyEvent e = (KeyEvent) event;
int eventID = event.getID();
boolean notInCompositionMode = buffer.length() == 0;
if (eventID == KeyEvent.KEY_PRESSED) {
// If we are not in composition mode, pass through
if (notInCompositionMode) {
return;
}
switch (e.getKeyCode()) {
case KeyEvent.VK_LEFT:
moveCaretLeft();
break;
case KeyEvent.VK_RIGHT:
moveCaretRight();
break;
}
} else if (eventID == KeyEvent.KEY_TYPED) {
char c = e.getKeyChar();
// If we are not in composition mode, wait a back slash
if (notInCompositionMode) {
// If the type character is not a back slash, pass through
if (c != '\\') {
return;
}
startComposition(); // Enter to composition mode
} else {
switch (c) {
case ' ': // Exit from composition mode
finishComposition();
break;
case '\u007f': // Delete
deleteCharacter();
break;
case '\b': // BackSpace
deletePreviousCharacter();
break;
case '\u001b': // Escape
cancelComposition();
break;
case '\n': // Return
case '\t': // Tab
sendCommittedText();
break;
default:
composeUnicodeEscape(c);
break;
}
}
} else { // KeyEvent.KEY_RELEASED
// If we are not in composition mode, pass through
if (notInCompositionMode) {
return;
}
}
e.consume();
}
示例15: keyPressed
/** {@inheritDoc} */
@Override
public void keyPressed(KeyEvent e) {
if (hasSelection()) {
switch (e.getKeyCode()) {
case KeyEvent.VK_DELETE:
case KeyEvent.VK_BACK_SPACE:
deleteSelection();
break;
case KeyEvent.VK_ESCAPE:
finishSelection();
break;
case KeyEvent.VK_LEFT:
setDirty();
adjustSelectionBounds(-1, 0);
redrawSelection();
break;
case KeyEvent.VK_RIGHT:
setDirty();
adjustSelectionBounds(1, 0);
redrawSelection();
break;
case KeyEvent.VK_UP:
setDirty();
adjustSelectionBounds(0, -1);
redrawSelection();
break;
case KeyEvent.VK_DOWN:
setDirty();
adjustSelectionBounds(0, 1);
redrawSelection();
break;
}
}
}