本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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;
}
}
}