當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。