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


Java KeyEvent.VK_RIGHT属性代码示例

本文整理汇总了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);            
    }

}
 
开发者ID:iapafoto,项目名称:DicomViewer,代码行数:21,代码来源:PanelController.java

示例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;
    }
}
 
开发者ID:Silvanosky,项目名称:StellarCrush,代码行数:23,代码来源:MainKeyListener.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:NbiTreeTable.java

示例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();
    }
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:25,代码来源:SetupStack.java

示例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();
    }
}
 
开发者ID:Exia-Aix-A2,项目名称:Boulder-Dash,代码行数:23,代码来源:ArrowKeyControl.java

示例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();
  }
}
 
开发者ID:etomica,项目名称:etomica,代码行数:18,代码来源:KeyboardControl.java

示例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);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:KeyboardMenuNavigator.java

示例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();
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:33,代码来源:Scroller.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:FileCompletionPopup.java

示例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();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:DirectoryChooserUI.java

示例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;
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:38,代码来源:ImageCommand.java

示例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;

		}

	}
 
开发者ID:dviol,项目名称:Project15,代码行数:38,代码来源:Player.java

示例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;
}
 
开发者ID:tonikolaba,项目名称:BatBat-Game,代码行数:12,代码来源:Keys.java

示例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();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:71,代码来源:CodePointInputMethod.java

示例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;
        }
    }
}
 
开发者ID:defano,项目名称:jmonet,代码行数:41,代码来源:AbstractSelectionTool.java


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