How to detect that a PC has been idle for 30 seconds using Java?

后端 未结 4 2003
小蘑菇
小蘑菇 2020-12-31 16:34

How to detect that a PC has been idle for 30 seconds using Java?

EDITED

With idle I mean that there are no user activity. The user does nothing in 30 seconds

4条回答
  •  时光取名叫无心
    2020-12-31 17:16

    I've come across this excellent example of detecting system wide idle time using JNA. Java Native Access (JNA) is a library that provides access to Java Native Interface (JNI) without the need for you to actually write native code.

    Here's the example that is very close to what you're asking for.

提交回复
热议问题