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


Java Canvas.KEY_NUM2属性代码示例

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


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

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

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

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

示例4: parseKeyboardKey

private int parseKeyboardKey(String keyName)
{
 	if (keyName == null) {
 		return -1;
 	}
// TODO poprawic KeyEvent	
if (keyName.equals("VK_LEFT")) {
	return SWT.ARROW_LEFT;
} else if (keyName.equals("VK_RIGHT")) {
	return SWT.ARROW_RIGHT;
} else if (keyName.equals("VK_UP")) {
	return SWT.ARROW_UP;
} else if (keyName.equals("VK_DOWN")) {
	return SWT.ARROW_DOWN;
} else if (keyName.equals("VK_ENTER")) {
	return SWT.CR;
} else if (keyName.equals("VK_F1")) {
	return SWT.F1;
} else if (keyName.equals("VK_F2")) {
	return SWT.F2;
} else if (keyName.equals("VK_0")) {
	return Canvas.KEY_NUM0;
} else if (keyName.equals("VK_1")) {
	return Canvas.KEY_NUM1;
} else if (keyName.equals("VK_2")) {
	return Canvas.KEY_NUM2;
} else if (keyName.equals("VK_3")) {
	return Canvas.KEY_NUM3;
} else if (keyName.equals("VK_4")) {
	return Canvas.KEY_NUM4;
} else if (keyName.equals("VK_5")) {
	return Canvas.KEY_NUM5;
} else if (keyName.equals("VK_6")) {
	return Canvas.KEY_NUM6;
} else if (keyName.equals("VK_7")) {
	return Canvas.KEY_NUM7;
} else if (keyName.equals("VK_8")) {
	return Canvas.KEY_NUM8;
} else if (keyName.equals("VK_9")) {
	return Canvas.KEY_NUM9;
} else if (keyName.equals("VK_MULTIPLY")) {
	return Canvas.KEY_STAR;
} else if (keyName.equals("VK_MODECHANGE")) {
	return Canvas.KEY_POUND;
} else {
	try {
		return Integer.parseInt(keyName);
	} catch (NumberFormatException ex) {
		return -1;
	}
}
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:52,代码来源:SwtButton.java


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