如何使用Java获取全局活动窗口的名称?

发布于 2024-09-05 17:13:54 字数 199 浏览 1 评论 0原文

我正在工作一个桌面应用程序,其中我需要在文本文件中保存当前聚焦或活动窗口名称(mozilla firefox,或任何其他文件名)的名称,目前我正在使用 KeyboardFocusManager 的 getActiveWindow() 方法,该方法给出的名称活动窗口,如果活动窗口不是调用线程上下文的成员,则为 null。

我想获取当前用户正在使用的全局活动窗口的名称。

I am work an Desktop Application in which i need to save the name of corrently focused or active window name(mozilla firefox, or any other file name) in an text file currently I am using getActiveWindow() method of KeyboardFocusManager which give the name of active Window, or null if the active Window is not a member of the calling thread's context.

I want to get the name of Global Active window which corrently user is using.

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

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

发布评论

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

评论(1

红玫瑰 2024-09-12 17:13:54

如果它必须是跨平台的,你可能会不走运。 Java VM 只知道它控制的窗口。现在,您可能可以通过 JNI 以本机代码执行此操作,但您必须为计划部署的每个平台包含本机二进制文件。

You're probably out of luck if it has to be cross-platform. The Java VM only knows about the windows it controls. Now, you could likely do it in native code, through JNI, but you'd have to include native binaries for every platform you plan to deploy on.

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