本文整理汇总了Java中java.awt.event.KeyEvent.KEY_LOCATION_RIGHT属性的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.KEY_LOCATION_RIGHT属性的具体用法?Java KeyEvent.KEY_LOCATION_RIGHT怎么用?Java KeyEvent.KEY_LOCATION_RIGHT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.event.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.KEY_LOCATION_RIGHT属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: keyCodeToInput
private Inputs keyCodeToInput(int keyCode, int keyLocation) {
switch (keyCode) {
case KeyEvent.VK_UP:
return Inputs.RightDPadUp;
case KeyEvent.VK_DOWN:
return Inputs.RightDPadDown;
case KeyEvent.VK_LEFT:
return Inputs.RightDPadLeft;
case KeyEvent.VK_RIGHT:
return Inputs.RightDPadRight;
case KeyEvent.VK_I:
return Inputs.RightDPadUp;
case KeyEvent.VK_K:
return Inputs.RightDPadDown;
case KeyEvent.VK_J:
return Inputs.RightDPadLeft;
case KeyEvent.VK_L:
return Inputs.RightDPadRight;
case KeyEvent.VK_W:
return Inputs.LeftDPadUp;
case KeyEvent.VK_S:
return Inputs.LeftDPadDown;
case KeyEvent.VK_A:
return Inputs.LeftDPadLeft;
case KeyEvent.VK_D:
return Inputs.LeftDPadRight;
case KeyEvent.VK_SPACE:
return Inputs.Select;
case KeyEvent.VK_ENTER:
return Inputs.Start;
case KeyEvent.VK_F:
return Inputs.A;
case KeyEvent.VK_H:
return Inputs.B;
case KeyEvent.VK_E:
return Inputs.L;
case KeyEvent.VK_U:
return Inputs.R;
case KeyEvent.VK_CONTROL:
if (keyLocation == KeyEvent.KEY_LOCATION_RIGHT) {
return Inputs.A;
}
break;
case KeyEvent.VK_NUMPAD0:
return Inputs.B;
case KeyEvent.VK_B:
return Inputs.LowBattery;
}
return null;
}