Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我可以将Exit命令分配给#Lwuit 应用程序中的键吗?当我按下 key时,应该会自动调用#该命令并退出应用程序。Exit
Exit
您应该在表单上侦听 KeyPress 或 keyReleased 事件,并在按下 # 键时使用 # 和 exitApplication 的键码。
protected void keyPressed(int key) { System.out.println("Key Pressed"); if(key==52) //change 52 to match keyCode for # key { Display.getInstance().exitApplication(); } }