case Canvas.KEY_NUM0: case Canvas.KEY_NUM1: case Canvas.KEY_NUM2: case Canvas.KEY_NUM3: case Canvas.KEY_NUM4: case Canvas.KEY_NUM5: case Canvas.KEY_NUM6: case Canvas.KEY_NUM7: case Canvas.KEY_NUM8: case Canvas.KEY_NUM9: int rval = KeyEvent.VK_0 + (gameAction-Canvas.KEY_NUM0); return rval; case Canvas.KEY_POUND: return KeyEvent.VK_NUMBER_SIGN; case Canvas.KEY_STAR: return KeyEvent.VK_MULTIPLY; default: return 0; }
default: throw new IllegalArgumentException(); }
  public int getKeyCode(int gameAction)   {        switch (gameAction) {        case Canvas.UP:            return KeyEvent.VK_UP;        case Canvas.DOWN:            return KeyEvent.VK_DOWN;        case Canvas.LEFT:            return KeyEvent.VK_LEFT;        case Canvas.RIGHT:            return KeyEvent.VK_RIGHT;        case Canvas.FIRE:            return KeyEvent.VK_ENTER;        case Canvas.GAME_A:            return KeyEvent.VK_A;        case Canvas.GAME_B:            return KeyEvent.VK_B;        case Canvas.GAME_C:            return KeyEvent.VK_C;        case Canvas.GAME_D:            return KeyEvent.VK_D;        case Canvas.KEY_NUM0:        case Canvas.KEY_NUM1:        case Canvas.KEY_NUM2:                case Canvas.KEY_NUM3:                case Canvas.KEY_NUM4:        case Canvas.KEY_NUM5:        case Canvas.KEY_NUM6:        case Canvas.KEY_NUM7:                case Canvas.KEY_NUM8:                case Canvas.KEY_NUM9:            int rval = KeyEvent.VK_0 + (gameAction-Canvas.KEY_NUM0);            return rval;        case Canvas.KEY_POUND:            return KeyEvent.VK_NUMBER_SIGN;        case Canvas.KEY_STAR:            return KeyEvent.VK_MULTIPLY;        default:            return 0;        }  }