有没有办法让Java应用程序检测屏幕是否被锁定?

编程入门 行业动态 更新时间:2024-10-24 06:26:21
本文介绍了有没有办法让Java应用程序检测屏幕是否被锁定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在寻找一种在Java应用程序中知道的方法(没有 JNI - 它是一个多平台应用程序)可以检测屏幕是否被锁定。

I'm looking for a way to know in a Java application (without JNI - it's a multi-platform application) can detect if the screen is locked.

有关信息...我们的应用程序记录用户工作时间 - 我们希望它在屏幕被锁定时自动停止录制而不是用户必须明确地停止录制。

For information... our application records time while a user is working - we want it to automatically stop recording when the screen is locked instead of the user having to do so explicitly.

推荐答案

我认为没有一个API,甚至没有办法做到这一切。解析java.awt.Robot生成的屏幕截图既不是平台也不是版本甚至是配置独立的,一般来说,我不认为屏幕被锁定是一个足够明确的概念,在这个意义上使用 - 在Linux上,可以有不止一个屏幕(X服务器),你可以切换到控制台终端,你可以让运行一台(或多台)机器的应用程序通过网络在另一台机器上显示它们的GUI ...

I don't think there is an API for that or even a way to do it all. Parsing screenshots generated by java.awt.Robot is neither platform- nor version- or even configuration-independant, and in general, I don't think "screen is locked" is a well-enough defined concept to be used in this sense - on Linux, there can be more than just one "screen" (X server), you can switch to console terminals, you can have applications running one (or more) machines display their GUIs on another machine over the network...

更多推荐

有没有办法让Java应用程序检测屏幕是否被锁定?

本文发布于:2023-11-05 05:01:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1559977.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:没有办法   应用程序   屏幕   Java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!