Hi, I am doing a small website assignment on Java GUI and I decided to implement a function on listening the mouse where if the mouse is not move or click and a few seconds it will logout. I found an example in oracle on mouse motion listener but I'm not sure how to use the codes. Can anyone help and give a little advice?
posted 5 years ago
Welcome to the Ranch
Maybe you should try a timer. The mouse motion listener and the mouse listener (you need both) reset a timeInactive variable to 0. The timer increases the timeInactive variable, and when it reaches the allowable timeout, you can fire the logoff. You wil find out about timers here and here.
Beware: Those two timers are different, and have to be used differently.