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


Java Canvas.DOWN属性代码示例

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


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

示例1: getGameAction

@Override
public int getGameAction(int keyCode) {
	// TODO implement as lookup table
	int gameAction;
	switch (keyCode) {
	case -5 :
		gameAction = Canvas.FIRE;
		break;
	case -1 :
		gameAction = Canvas.UP;
		break;
	case -2 :
		gameAction = Canvas.DOWN;
		break;
	case -3 :
		gameAction = Canvas.LEFT;
		break;
	case -4 :
		gameAction = Canvas.RIGHT;
		break;
	default:
		gameAction = 0; 
	}

	return gameAction;
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:26,代码来源:AndroidInputMethod.java

示例2: handleKeyReleased

protected boolean handleKeyReleased(int keyCode, int gameAction) {
    if(super.handleKeyReleased(keyCode, gameAction)) {
        //Don't do anything that already does something.
        return true;
    } else {
        if(finished) {
            //scrolling should be uninterrupted
            switch(gameAction) {
            case Canvas.UP:
            case Canvas.DOWN:
            case Canvas.LEFT:
            case Canvas.RIGHT:
                return false;
            default:
                UiAccess.cast(this.getCommandListener()).commandAction(CANCEL,this);
                return true;
            }
        }
        return false;
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:21,代码来源:CommCareOTAFailView.java

示例3: handleKeyReleased

protected boolean handleKeyReleased(int keyCode, int gameAction) {
    if(super.handleKeyReleased(keyCode, gameAction)) {
        //Don't do anything that already does something.
        return true;
    } else {
        if(finished) {
            //scrolling should be uninterrupted
            switch(gameAction) {
            case Canvas.UP:
            case Canvas.DOWN:
            case Canvas.LEFT:
            case Canvas.RIGHT:
                return false;
            default:
                UiAccess.cast(this.getCommandListener()).commandAction(FINISHED,this);
                return true;
            }
        }
        return false;
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:21,代码来源:CommCareOTARestoreView.java

示例4: handleKeyReleased

protected boolean handleKeyReleased(int keyCode, int gameAction) {
    //because we're manually processing these, we need to replicate some
    //of the structure we'd normally use for dealing with down/up events
    //across native input/etc.
    if(loaded) {
    try {
        if (gameAction == Canvas.UP && keyCode != Canvas.KEY_NUM2) {
            stepIndex(false);
            refreshList();
            return true;
        } else if (gameAction == Canvas.DOWN && keyCode != Canvas.KEY_NUM8) {
            stepIndex(true);
            refreshList();
            return true;
        } else if (gameAction == Canvas.FIRE && keyCode != Canvas.KEY_NUM5) {
            processSelect();
            return true;
        }

    } catch (Exception e) {
        Logger.die("gui-keyup", e);
    }
    }

    return super.handleKeyReleased(keyCode, gameAction);
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:26,代码来源:EntitySelectView.java

示例5: keyPressed

/**
 * deal with any key presses
 */
protected void keyPressed(int keyCode) {
	switch(keyCode){
	case -1:	//up
	case Canvas.UP:
		y = getY(y+=STEP);
		break;
	case -2: //down
	case Canvas.DOWN:
		y = getY(y+=-STEP);
		break;
	case -3:	//left
	case Canvas.LEFT:
		x = getX(x+=STEP);
		break;
	case -4: //right
	case Canvas.RIGHT:
		x = getX(x+=-STEP);
		break;
	default:
	}
	repaint();

}
 
开发者ID:mozilla,项目名称:pluotsorbet,代码行数:26,代码来源:PanoramaCanvas.java

示例6: InputManager

private InputManager() {
	up = new Input(Canvas.UP);
	down = new Input(Canvas.DOWN);
	left = new Input(Canvas.LEFT);
	right = new Input(Canvas.RIGHT);
	fire = new Input(Canvas.FIRE);
	gamea = new Input(Canvas.GAME_A);
	gameb = new Input(Canvas.GAME_B);
	gamec = new Input(Canvas.GAME_C);
	gamed = new Input(Canvas.GAME_D);
	
	num0 = new Input(Canvas.KEY_NUM0);
	num1 = new Input(Canvas.KEY_NUM1);
	num2 = new Input(Canvas.KEY_NUM2);
	num3 = new Input(Canvas.KEY_NUM3);
	num4 = new Input(Canvas.KEY_NUM4);
	num5 = new Input(Canvas.KEY_NUM5);
	num6 = new Input(Canvas.KEY_NUM6);
	num7 = new Input(Canvas.KEY_NUM7);
	num8 = new Input(Canvas.KEY_NUM8);
	num9 = new Input(Canvas.KEY_NUM9);
	star = new Input(Canvas.KEY_STAR);
	pound = new Input(Canvas.KEY_POUND);
}
 
开发者ID:RobDangerous,项目名称:Jademula,代码行数:24,代码来源:InputManager.java

示例7: getKeyCode

@Override
public int getKeyCode(int gameAction) {
	int keyCode;
	switch (gameAction) {
	case Canvas.FIRE:
		keyCode = -5;
		break;
	case Canvas.UP:
		keyCode = -1;
		break;
	case Canvas.DOWN:
		keyCode = -2;
		break;
	case Canvas.LEFT:
		keyCode = -3;
		break;
	case Canvas.RIGHT:
		keyCode = -4;
		break;
	case Canvas.GAME_A:
		keyCode = Canvas.GAME_A;
		break;
	case Canvas.GAME_B:
		keyCode = Canvas.GAME_B;
		break;
	case Canvas.GAME_C:
		keyCode = Canvas.GAME_C;
		break;
	case Canvas.GAME_D:
		keyCode = Canvas.GAME_D;
		break;
	default:
		throw new IllegalArgumentException();
	}

	return keyCode;
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:37,代码来源:AndroidInputMethod.java

示例8: getKeyName

@Override
public String getKeyName(int keyCode) throws IllegalArgumentException {
	// TODO implement as lookup table
	String keyName;
	switch (keyCode) {
	case Canvas.FIRE:
		keyName = "FIRE";
		break;
	case Canvas.UP:
		keyName = "UP";
		break;
	case Canvas.DOWN:
		keyName = "DOWN";
		break;
	case Canvas.LEFT:
		keyName = "LEFT";
		break;
	case Canvas.RIGHT:
		keyName = "RIGHT";
		break;
	case Canvas.GAME_A:
		keyName = "GAME_A";
		break;
	case Canvas.GAME_B:
		keyName = "GAME_B";
		break;
	case Canvas.GAME_C:
		keyName = "GAME_C";
		break;
	case Canvas.GAME_D:
		keyName = "GAME_D";
		break;
	default:
		keyName = Character.toString((char) keyCode);
	}

	return keyName;
}
 
开发者ID:Helltar,项目名称:AMPASIDE,代码行数:38,代码来源:AndroidInputMethod.java

示例9: handleKeyPressed

protected boolean handleKeyPressed(int keyCode, int gameAction) {
    loaded = true;

    //Supress these actions, letting the propogates screws up scrolling on some platforms.
    if (gameAction == Canvas.UP && keyCode != Canvas.KEY_NUM2) {
        return true;
    } else if (gameAction == Canvas.DOWN && keyCode != Canvas.KEY_NUM8) {
        return true;
    }
    return super.handleKeyPressed(keyCode, gameAction);
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:11,代码来源:EntitySelectView.java

示例10: getGameAction

public int getGameAction(int keyCode) {
	// TODO fix KeyEvent
	switch (keyCode) {
	case SWT.ARROW_UP:
		return Canvas.UP;

	case SWT.ARROW_DOWN:
		return Canvas.DOWN;

	case SWT.ARROW_LEFT:
		return Canvas.LEFT;

	case SWT.ARROW_RIGHT:
		return Canvas.RIGHT;

	case SWT.CR:
		return Canvas.FIRE;

		/*
		 * case KeyEvent.VK_1: case KeyEvent.VK_A: return Canvas.GAME_A;
		 * 
		 * case KeyEvent.VK_3: case KeyEvent.VK_B: return Canvas.GAME_B;
		 * 
		 * case KeyEvent.VK_7: case KeyEvent.VK_C: return Canvas.GAME_C;
		 * 
		 * case KeyEvent.VK_9: case KeyEvent.VK_D: return Canvas.GAME_D;
		 */

	default:
		return 0;
	}
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:32,代码来源:SwtInputMethod.java

示例11: getKeyCode

public int getKeyCode(int gameAction) {
	// TODO fix KeyEvent
	switch (gameAction) {
	case Canvas.UP:
		return SWT.ARROW_UP;

	case Canvas.DOWN:
		return SWT.ARROW_DOWN;

	case Canvas.LEFT:
		return SWT.ARROW_LEFT;

	case Canvas.RIGHT:
		return SWT.ARROW_RIGHT;

	case Canvas.FIRE:
		return SWT.CR;

		/*
		 * case Canvas.GAME_A: return KeyEvent.VK_1;
		 * 
		 * case Canvas.GAME_B: return KeyEvent.VK_3;
		 * 
		 * case Canvas.GAME_C: return KeyEvent.VK_7;
		 * 
		 * case Canvas.GAME_D: return KeyEvent.VK_9;
		 */

	default:
		throw new IllegalArgumentException();
	}
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:32,代码来源:SwtInputMethod.java

示例12: handleKeyPressed

protected boolean handleKeyPressed(int keyCode, int gameAction){

            //We might want to handle number keys if we aren't focussed, but we don't want to handle anything else
            if(!this.isFocused && !isNumKey(keyCode)) {
                return false;
            }

            //In numeric navigation mode, so we only want to allow navigation with those keys, and
            //hide other cues
            if(numericNavigation) {
                //Reject up and down
                if((gameAction == Canvas.UP || gameAction == Canvas.DOWN) && !isNumKey(keyCode)) {
                    return false;
                }

                //If the user hasn't made a navigation choice, swallow the fire key.
                if(!touched && getScreen().isGameActionFire(keyCode, gameAction)) {
                    return false;
                }
            }

            //
            if(isNumKey(keyCode)) {

                touch();

                if(!autoSelect) {
                    int index = keyCode-Canvas.KEY_NUM1;
                    if(index < this.itemsList.size()){
                        doAudio(index,true);
                        if(this.parent != null && this.parent instanceof Container) {
                            Container c = (Container)this.parent;
                            c.focusChild(c.indexOf(this));
                        }
                        super.focusChild(index);
                    }else{
                        return super.handleKeyPressed(keyCode,gameAction);
                    }
                    return true;
                } else {
                    return super.handleKeyPressed(keyCode,gameAction);
                }
            }
            return super.handleKeyPressed(keyCode,gameAction);
        }
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:45,代码来源:CustomChoiceGroup.java


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