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


Java KeyEvent.VK_D属性代码示例

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


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

示例1: keyReleased

@Override
public void keyReleased(final @NonNull KeyEvent e) {
    switch (e.getKeyCode()) {
        case KeyEvent.VK_UP:
        case KeyEvent.VK_W: {
            map.getPlayer().move(0, -1);
            break;
        }
        case KeyEvent.VK_DOWN:
        case KeyEvent.VK_S: {
            map.getPlayer().move(0, 1);
            break;
        }
        case KeyEvent.VK_LEFT:
        case KeyEvent.VK_A: {
            map.getPlayer().move(-1, 0);
            break;
        }
        case KeyEvent.VK_RIGHT:
        case KeyEvent.VK_D: {
            map.getPlayer().move(1, 0);
            break;
        }
    }
}
 
开发者ID:Valkryst,项目名称:VRoguelike,代码行数:25,代码来源:GameScreen.java

示例2: usableKeyOnMac

private static boolean usableKeyOnMac(int key, int mask) {
    //All permutations fail for Q except ctrl
    if (key == KeyEvent.VK_Q) {
        return false;
    }

    boolean isMeta = ((mask & KeyEvent.META_MASK) != 0) || ((mask & KeyEvent.CTRL_DOWN_MASK) != 0);

    boolean isAlt = ((mask & KeyEvent.ALT_MASK) != 0) || ((mask & KeyEvent.ALT_DOWN_MASK) != 0);

    boolean isOnlyMeta = isMeta && ((mask & ~(KeyEvent.META_DOWN_MASK | KeyEvent.META_MASK)) == 0);

    //Mac OS consumes keys Command+ these keys - the app will never see
    //them, so CTRL should not be remapped for these
    if (isOnlyMeta) {
        return (key != KeyEvent.VK_H) && (key != KeyEvent.VK_SPACE) && (key != KeyEvent.VK_TAB);
    }
    if ((key == KeyEvent.VK_D) && isMeta && isAlt) {
        return false;
    }
    if (key == KeyEvent.VK_SPACE && isMeta && ((mask & KeyEvent.CTRL_MASK) != 0)) {
        // http://lists.apple.com/archives/java-dev/2010/Aug/msg00002.html
        return false;
    }
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:Utilities.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: processeAtalhos

public boolean processeAtalhos(int keyCode) {
    boolean res = false;
    switch (keyCode) {
        case KeyEvent.VK_V:
            doPaste();
            res = true;
            break;
        case KeyEvent.VK_Q:
            Sair();
            res = true;
            break;
        case KeyEvent.VK_D:
            Cancelar();
            res = true;
            break;
    }
    return res;
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:18,代码来源:MasterCli.java

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

示例6: keyPressed

/**
 * Wir überschreiben was beim drücken einer Taste passiert.
 * hat den nachteil das ohne unser zutun sonst nix mehr passiert
 * z.B. ESC oder ähnliches.
 * @param e 
 */
@Override
public void keyPressed(KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_S) {
        setKey_down(true);
    }
    if (e.getKeyCode() == KeyEvent.VK_W) {
        setKey_up(true);
    }
    if (e.getKeyCode() == KeyEvent.VK_D) {
        setKey_right(true);
    }
    if (e.getKeyCode() == KeyEvent.VK_A) {
        setKey_left(true);
    }
    if(e.getKeyCode() == KeyEvent.VK_ESCAPE){
        System.exit(0);
    }
}
 
开发者ID:Marc-Reis,项目名称:CitizenOfTheStars2D,代码行数:24,代码来源:Frame.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: keyReleased

private void keyReleased(KeyEvent e) {
	int key = e.getKeyCode();
	
	switch (key) {
		case KeyEvent.VK_W: // up
			System.out.println("W pressed.");
			_board.handleUp("W" );
			break;
		case KeyEvent.VK_S: // down
			System.out.println("S pressed.");
			_board.handleDown("S");
			break;
		case KeyEvent.VK_A: // left
			System.out.println("A pressed.");
			_board.handleLeft("A");
			break;
		case KeyEvent.VK_D: // right
			System.out.println("D pressed.");
			_board.handleRight("D");
			break;
		default:
	}		
}
 
开发者ID:lukealba,项目名称:2048-java-swing,代码行数:23,代码来源:Main.java

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

示例10: keyPressed

public void keyPressed(KeyEvent event) {
    int code = event.getKeyCode();
    switch (code) {
        case KeyEvent.VK_TAB:
            completeAction(event);
            break;
        case KeyEvent.VK_LEFT:
        case KeyEvent.VK_BACK_SPACE:
            backAction(event);
            break;
        case KeyEvent.VK_UP:
            upAction(event);
            break;
        case KeyEvent.VK_DOWN:
            downAction(event);
            break;
        case KeyEvent.VK_ENTER:
            enterAction(event);
            break;
        case KeyEvent.VK_HOME:
            event.consume();
            area.setCaretPosition(startPos);
            break;
        case KeyEvent.VK_D:
            if ((event.getModifiersEx() & KeyEvent.CTRL_DOWN_MASK) != 0) {
                event.consume();
                inputJoin.send(Channel.LINE, EMPTY_LINE);
            }
            break;
    }

    if (completePopup.isVisible() && code != KeyEvent.VK_TAB
            && code != KeyEvent.VK_UP && code != KeyEvent.VK_DOWN)
        completePopup.setVisible(false);
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:35,代码来源:TextAreaReadline.java

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

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

示例13: keyReleased

@Override
public void keyReleased(KeyEvent e){
	if(DynamicBeat.game == null){
		return;
	}
	if(e.getKeyCode()==KeyEvent.VK_S){
		DynamicBeat.game.releaseS();
	}
	else if(e.getKeyCode()==KeyEvent.VK_D){
		DynamicBeat.game.releaseD();
	}
	else if(e.getKeyCode()==KeyEvent.VK_F){
		DynamicBeat.game.releaseF();
			}
	else if(e.getKeyCode()==KeyEvent.VK_SPACE){
		DynamicBeat.game.releaseSpace();
	}
	else if(e.getKeyCode()==KeyEvent.VK_J){
		DynamicBeat.game.releaseJ();
	}
	else if(e.getKeyCode()==KeyEvent.VK_K){
		DynamicBeat.game.releaseK();
	}
	else if(e.getKeyCode()==KeyEvent.VK_L){
		DynamicBeat.game.releaseL();
	}

}
 
开发者ID:beargrllys,项目名称:OverTale,代码行数:28,代码来源:KeyListener.java

示例14: keyTyped

public void keyTyped(KeyEvent e) {
	if (e.isControlDown()) {
		if (e.getKeyCode()==KeyEvent.VK_C) copy();
		else if (e.getKeyCode()==KeyEvent.VK_X) cut();
		else if (e.getKeyCode()==KeyEvent.VK_V) paste();
		else if (e.getKeyCode()==KeyEvent.VK_D) delete();
		else if (e.getKeyCode()==KeyEvent.VK_E) edit();
		else if (e.getKeyCode()==KeyEvent.VK_N) newEntry();
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:10,代码来源:XMLJTreeDialog.java

示例15: handleCtrlKey

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

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

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

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

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


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