日期:2014-05-20  浏览次数:20634 次

keypressed问题
在Canvas中有keyPressed方法可以知道用户输入的按键键值,但是我想在Form中也可以得到按键内容比如OK键(-5)需要用什么方法呢。

------解决方案--------------------
CustomItem中处理按键的方法

int getGameAction(int keyCode)
Gets the game action associated with the given key code of the device.
protected void keyPressed(int keyCode)
Called by the system when a key is pressed.
protected void keyReleased(int keyCode)
Called by the system when a key is released.
protected void keyRepeated(int keyCode)
Called by the system when a key is repeated.

触摸笔处理
protected void pointerDragged(int x, int y)
Called by the system when a pointer drag action
protected void pointerPressed(int x, int y)
Called by the system when a pointer down action
protected void pointerReleased(int x, int y)
Called by the system when a pointer up action