I am writing a desktop application in which I want to perform an operation if user doesn't use the computer for X number of minutes. Just like auto idle in MSN messager or skype. Any hints?
Is there anyway to detect user inactivity in java?
6.2k views Asked by qasimzee At
3
There are 3 answers
1
On
You can use a background thread that basically only sleeps idle or a quartz task if you are not already using any timer/job scheduler library.
1
On
you need to:
- listen for events at the application level
- track the time interval between these events
read here this article. you have the code under InactivityListener.java
And there is even a similar thread: How to detect inactivity/idle time since last keypressed on j2me
I found https://code.google.com/p/fiat-lux/source/browse/Fiat+Lux/src/fiatlux/os/time/ that served my purpose.
Thanks