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.