首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2ME开发 >

keypressed有关问题

2012-01-05 
keypressed问题在Canvas中有keyPressed方法可以知道用户输入的按键键值,但是我想在Form中也可以得到按键内

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

热点排行