Java桌面应用程序:按下热键时如何最大化托盘应用程序?

发布于 2024-07-19 01:57:09 字数 389 浏览 4 评论 0原文

我需要编写一个程序,当最小化时,该程序位于系统托盘中,我将使用 Java 6 的 SystemTray API 来完成此任务。

当用户按下某个热键时,如何使该应用程序进入前台?

例如,应用程序正在运行但已最小化。 当用户按下 CTRL-SHIFT-Y 或其他键(或者像 Google 桌面的搜索一样,按 CTRL 两次)时,应用程序就会最大化。

编辑:我知道如何将Java窗口带到前台。 我更具体地询问如何使正在运行的 Java 应用程序侦听热键

I need to write a program that, when minimized, lives in the System Tray, and I'll use Java 6's SystemTray API to do that.

How can I make that application comes to the foreground when the user presses some hotkey?

For example, the app is running but minimized. When the user presses CTRL-SHIFT-Y or something (or, like Google Desktop's search, CTRL twice) and the application is maximized.

EDIT: I know about how to bring a Java window to the foreground. I'm asking more specifically about how to make a running Java app listen for a hotkey.

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

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

发布评论

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

评论(2

ˇ宁静的妩媚 2024-07-26 01:57:09

您将需要求助于 JNI,请查看示例

这是来自 Sun 论坛的另一个很好的示例

You're going to need to resort to JNI, check out an example.

Here's another nice example from Sun's forums.

毁梦 2024-07-26 01:57:09

您可以使用以下 SWT 扩展库创建一个可以侦听热键的键盘挂钩 - http://feeling。 sourceforge.net/

请注意,这仅适用于 Windows(但这对您来说可能不是问题)。

You can use the following SWT extension library to create a keyboard hook that can listen for your hot key - http://feeling.sourceforge.net/

note, that this is windows only (but that may not be a problem for you).

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