Can I assign the Exit
Command to the # key in an Lwuit Application? When I press the key #, the Exit
command should be called automatically and exit the application.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You should listen for a KeyPress or keyReleased event on the form with the keycode for # and exitApplication when the # key is pressed.
protected void keyPressed(int key)
{
System.out.println("Key Pressed");
if(key==52) //change 52 to match keyCode for # key
{
Display.getInstance().exitApplication();
}
}