当我在 Lwuit 移动应用程序中按 # 键时如何调用退出命令?

发布于 2024-12-26 13:12:37 字数 120 浏览 2 评论 0原文

我可以将 Exit 命令分配给 Lwuit 应用程序中的 # 键吗?当我按下 # 键时,应自动调用 Exit 命令并退出应用程序。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

悟红尘 2025-01-02 13:12:37

您应该在表单上监听 KeyPress 或 keyReleased 事件,并在按下 # 键时使用 # 的键码并退出应用程序。

protected void keyPressed(int key)
{
    System.out.println("Key Pressed");

    if(key==52) //change 52 to match keyCode for # key 
    {
      Display.getInstance().exitApplication();
    }
}

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();
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文