Adel ESSAFI wrote:
Hi list
I am developping a tool with java and I want to know the inactivity time
of the user, i.e, the duration of the time that the keybord and mouse
were not used.
Use a static variable (secondsSincePress) in your main class (e.g.
MyProgram), add a keyPressed method (along with blank methods for the
rest of the KeyListener interface) that sets secondsSincePress to 0,
then call MainJFrame.addKeyListener from MyProgram's main. It is
basically the same thing for mouse (MouseListener), except I don't think
there's any way to detect mouse /movements/ (only presses and entering
and leaving the window).
Let us know if you still have questions.
Matt Flaschen