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


Java KeyEvent.VK_A属性代码示例

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


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

示例1: keyPressed

@Override
public void keyPressed(KeyEvent e) {
    int keyCode = e.getKeyCode();
    char ch = 0;
    if (KeyEvent.VK_0 <= keyCode && keyCode <= KeyEvent.VK_9) {
        ch = (char) ((keyCode - KeyEvent.VK_0) + '0');
    } else if (KeyEvent.VK_A <= keyCode && keyCode <= KeyEvent.VK_Z) {
        ch = (char) ((keyCode - KeyEvent.VK_A) + 'A');
    }
    if (ch != 0) {
        BookmarkInfo bookmark = key2bookmark.get(ch);
        if (bookmark != null) {
            result = bookmark;
            dispose();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:BookmarkKeyChooser.java

示例2: keyReleased

/**
 * Gleiches spiel nur für das Loslassen einer Taste
 * @param e 
 */
@Override
public void keyReleased(KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_S) {
        setKey_down(false);
    }
    if (e.getKeyCode() == KeyEvent.VK_W) {
        setKey_up(false);
    }
    if (e.getKeyCode() == KeyEvent.VK_D) {
        setKey_right(false);
    }
    if (e.getKeyCode() == KeyEvent.VK_A) {
        setKey_left(false);
    }
}
 
开发者ID:Marc-Reis,项目名称:CitizenOfTheStars2D,代码行数:19,代码来源:Frame.java

示例3: keyReleased

@Override
public void keyReleased(KeyEvent e) {
    int key = e.getKeyCode();

    switch (key) {
        case (KeyEvent.VK_A):
            gui.gs.horizontalMove(false);
            break;
        case (KeyEvent.VK_D):
            gui.gs.horizontalMove(true);
            break;
        case (KeyEvent.VK_J):
            gui.gs.rotate(false);
            break;
        case (KeyEvent.VK_L):
            gui.gs.rotate(true);
            break;
        case (KeyEvent.VK_S):
            gui.gs.drop(500);
    }
}
 
开发者ID:2017-SP-CS410,项目名称:Simple-Tetris,代码行数:21,代码来源:InputKeyEvent.java

示例4: keyReleased

public boolean keyReleased(KeyReleasedEvent e) {
    switch(e.getKey()) {
        case KeyEvent.VK_W:
        up = false;
        return true;
        case KeyEvent.VK_SPACE:
        up = false;
        return true;
        case KeyEvent.VK_A:
        left = false;
        return true;
        case KeyEvent.VK_S:
        return true;
        case KeyEvent.VK_D:
        right = false;
        return true;
    }
    return false;
}
 
开发者ID:ritcat14,项目名称:The-Mysterious-Mind-Of-Jack,代码行数:19,代码来源:Player.java

示例5: keyPressed

/**
 * Notification from AWT that a key has been pressed. Note that
 * a key being pressed is equal to being pushed down but *NOT*
 * released. Thats where keyTyped() comes in.
 * 
 * @param e
 *            The details of the key that was pressed
 */
@Override
public void keyPressed(KeyEvent e) {
	switch (e.getKeyCode()) {
	// Jump
	case KeyEvent.VK_W:
	// climb e jump
	case KeyEvent.VK_SPACE:
		game.player.startClimb();
		break;
	// move left
	case KeyEvent.VK_A:
		game.player.startLeft(e.isShiftDown());
		break;
	// move right
	case KeyEvent.VK_D:
		game.player.startRight(e.isShiftDown());
		break;
	}
}
 
开发者ID:DreamBlocks,项目名称:DreamBlocks,代码行数:27,代码来源:AwtEventsHandler.java

示例6: keyReleased

/**
 * Notification from AWT that a key has been released.
 * 
 * @param e
 *            The details of the key that was released
 */
@Override
public void keyReleased(KeyEvent e) {
	switch (e.getKeyCode()) {
	case KeyEvent.VK_W:
	case KeyEvent.VK_SPACE:
		game.player.endClimb();
		break;
	case KeyEvent.VK_A:
		game.player.stopLeft();
		break;
	case KeyEvent.VK_D:
		game.player.stopRight();
		break;
	// pressed ESC to return to the game menu
	case KeyEvent.VK_ESCAPE:
		if (game.isInInventory()) {
			game.closeInventory();
		} else {
			game.goToMainMenu();
		}
		break;
	}
}
 
开发者ID:DreamBlocks,项目名称:DreamBlocks,代码行数:29,代码来源:AwtEventsHandler.java

示例7: toggle

/**
	  * This method is used to turn keyboard key presses into actions
	  */
	 private void toggle(KeyEvent ke, boolean pressed) {
		  if ( ke.getKeyCode( ) == KeyEvent.VK_NUMPAD8 ) up.toggle( pressed ); //press keypad 8, moves up
		  if ( ke.getKeyCode( ) == KeyEvent.VK_NUMPAD2 ) down.toggle( pressed ); //press keypad 2, moves down
		  if ( ke.getKeyCode( ) == KeyEvent.VK_NUMPAD4 ) left.toggle( pressed ); //press keypad 4, moves left
		  if ( ke.getKeyCode( ) == KeyEvent.VK_NUMPAD6 ) right.toggle( pressed ); //press keypad 6, moves right
		  if ( ke.getKeyCode( ) == KeyEvent.VK_W ) up.toggle( pressed ); //press W, moves up
		  if ( ke.getKeyCode( ) == KeyEvent.VK_S ) down.toggle( pressed ); //press S, moves down
		  if ( ke.getKeyCode( ) == KeyEvent.VK_A ) left.toggle( pressed ); //press A, moves left
		  if ( ke.getKeyCode( ) == KeyEvent.VK_D ) right.toggle( pressed ); //press D, moves right
		  if ( ke.getKeyCode( ) == KeyEvent.VK_UP ) up.toggle( pressed ); //press up arrow, moves up
		  if ( ke.getKeyCode( ) == KeyEvent.VK_DOWN ) down.toggle( pressed ); //press down arrow, moves down
		  if ( ke.getKeyCode( ) == KeyEvent.VK_LEFT ) left.toggle( pressed ); //press left arrow, moves left
		  if ( ke.getKeyCode( ) == KeyEvent.VK_RIGHT ) right.toggle( pressed ); //press right arrow, moves right

//		  if ( ke.getKeyCode( ) == KeyEvent.VK_TAB ) menu.toggle( pressed ); //press Tab, menu toggled
//		  if ( ke.getKeyCode( ) == KeyEvent.VK_ALT ) menu.toggle( pressed ); //press Alt, menu toggled
		  if ( ke.getKeyCode( ) == KeyEvent.VK_ALT_GRAPH ) menu.toggle( pressed ); //press Alt-Graph, menu toggled
		  if ( ke.getKeyCode( ) == KeyEvent.VK_SPACE ) attack.toggle( pressed ); //press space, attack toggled
		  if ( ke.getKeyCode( ) == KeyEvent.VK_CONTROL ) attack.toggle( pressed ); //press Ctrl, attack toggled
		  if ( ke.getKeyCode( ) == KeyEvent.VK_NUMPAD0 ) attack.toggle( pressed ); //press keypad 0, attack toggled
		  if ( ke.getKeyCode( ) == KeyEvent.VK_INSERT ) attack.toggle( pressed ); //press Insert, attack toggled
		  if ( ke.getKeyCode( ) == KeyEvent.VK_ENTER ) menu.toggle( pressed ); //press Enter, attack toggled
		  
		  if ( ke.getKeyCode( ) == KeyEvent.VK_X ) menu.toggle( pressed ); //press X, menu toggled
		  if ( ke.getKeyCode( ) == KeyEvent.VK_C ) attack.toggle( pressed ); // press C, attack toggled
	 }
 
开发者ID:BrianGaucher,项目名称:Camasia,代码行数:29,代码来源:InputHandler.java

示例8: handleAltKey

/**
 * Handling of keyboard events when Alt key is pressed.
 *
 * @param key the key code
 */
private void handleAltKey(int key) {
    switch (key) {
        case KeyEvent.VK_A:
            // increase left
            gc.changeSizeSelection(-1, 0, 0, 0);
            break;

        case KeyEvent.VK_W:
            // increase top
            gc.changeSizeSelection(0, -1, 0, 0);
            break;

        case KeyEvent.VK_D:
            // increase right
            gc.changeSizeSelection(0, 0, 1, 0);
            break;

        case KeyEvent.VK_S:
            // increase bottom
            gc.changeSizeSelection(0, 0, 0, 1);
            break;

        case KeyEvent.VK_Z:
            // decrease box
            gc.changeSizeSelection(1, 1, -1, -1);
            break;

        case KeyEvent.VK_X:
            // increase box
            gc.changeSizeSelection(-1, -1, 1, 1);
            break;

        default:
            // do nothing
            break;
    }
}
 
开发者ID:buni-rock,项目名称:Pixie,代码行数:42,代码来源:GUILabelingTool.java

示例9: handleNormalKey

/**
 * Handle the keyboard events.
 *
 * @param key the key code
 */
private void handleNormalKey(int key) {
    switch (key) {
        case KeyEvent.VK_DELETE:
            deleteObject();
            break;

        case KeyEvent.VK_A:
            // move the box to the left                            
            moveObject(-1, 0);
            break;

        case KeyEvent.VK_D:
            // move the box to the right
            moveObject(1, 0);
            break;

        case KeyEvent.VK_W:
            // move the box up
            moveObject(0, -1);
            break;

        case KeyEvent.VK_S:
            // move the box down
            moveObject(0, 1);
            break;

        default:
            // do nothing
            break;
    }
}
 
开发者ID:buni-rock,项目名称:Pixie,代码行数:36,代码来源:BoundingBoxWindow.java

示例10: 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

示例11: ModifierRobotEnhancedKeyTest

public ModifierRobotEnhancedKeyTest() 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[6];
    textKeys[0] = KeyEvent.VK_A;
    textKeys[1] = KeyEvent.VK_S;
    textKeys[2] = KeyEvent.VK_DELETE;
    textKeys[3] = KeyEvent.VK_HOME;
    textKeys[4] = KeyEvent.VK_F12;
    textKeys[5] = KeyEvent.VK_LEFT;

    textStatus = new boolean[textKeys.length];

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

示例12: 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

示例13: keyPressed

@Override
public void keyPressed(KeyEvent e) {
    int keyCode = e.getKeyCode();
    char keyChar = e.getKeyChar();

    switch (state) {
        case 0:
            if (keyCode != KeyEvent.VK_ALT) {
                throw new RuntimeException("Alt is not pressed.");
            }
            state++;
            break;
        case 1:
            if (keyCode != KeyEvent.VK_DEAD_ACUTE) {
                throw new RuntimeException("Dead ACUTE is not pressed.");
            }
            if (keyChar != 0xB4) {
                throw new RuntimeException("Pressed char is not dead acute.");
            }

            state++;
            break;
        case 2:
            if (keyCode != KeyEvent.VK_A) {
                throw new RuntimeException("A is not pressed.");
            }
            if (keyChar != 0xE1) {
                throw new RuntimeException("A char does not have ACCUTE accent");
            }
            state++;
            break;
        default:
            throw new RuntimeException("Excessive keyPressed event.");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:35,代码来源:deadKeyMacOSX.java

示例14: handleAltKey

/**
 * Handle the keyboard events when Alt key is pressed.
 *
 * @param key the key code
 */
private void handleAltKey(int key) {
    switch (key) {
        case KeyEvent.VK_A:
            // increase left
            changeSize(-1, 0, 0, 0);
            break;

        case KeyEvent.VK_W:
            // increase top
            changeSize(0, -1, 0, 0);
            break;

        case KeyEvent.VK_D:
            // increase right
            changeSize(0, 0, 1, 0);
            break;

        case KeyEvent.VK_S:
            // increase bottom
            changeSize(0, 0, 0, 1);
            break;

        case KeyEvent.VK_Z:
            // decrease box
            changeSize(1, 1, -1, -1);
            break;

        case KeyEvent.VK_X:
            // increase box
            changeSize(-1, -1, 1, 1);
            break;

        default:
            // do nothing
            break;
    }
}
 
开发者ID:buni-rock,项目名称:Pixie,代码行数:42,代码来源:BoundingBoxWindow.java

示例15: handleCtrlKey

/**
 * Handling of the keyboard events when Control key is pressed.
 *
 * @param key the key code
 */
private void handleCtrlKey(int key) {
    switch (key) {
        case KeyEvent.VK_PLUS:
            log.info("Key pressed: Ctrl NumPad+ =  Zoom in");
            break;

        case KeyEvent.VK_MINUS:
            log.info("Key pressed: Ctrl NumPad- =  Zoom out");
            break;

        case KeyEvent.VK_A:
            // decrease left
            gc.changeSizeSelection(1, 0, 0, 0);
            break;

        case KeyEvent.VK_W:
            // decrease top
            gc.changeSizeSelection(0, 1, 0, 0);
            break;

        case KeyEvent.VK_D:
            // decrease right
            gc.changeSizeSelection(0, 0, -1, 0);
            break;

        case KeyEvent.VK_S:
            // decrease bottom
            gc.changeSizeSelection(0, 0, 0, -1);
            break;

        default:
            // do nothing
            break;
    }
}
 
开发者ID:buni-rock,项目名称:Pixie,代码行数:40,代码来源:GUILabelingTool.java


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