I have a fairly large swing application I’m maintaining and I have to add a timeout feature, basically where if the user hasn’t interacted with the application for a certain amount of time, the application should take a specific action (shutdown for example).
Due to the fact that this application is already written it would be an insurmountable task to make every mouselistener/keyboard listener/any kind of input listener to extend/implement a specific class/interface that would store the last time a user-initiated event happened.
Does swing already have some sort of utlity built in for something like this? What would be a good way to implement this functionality short of altering all mouse/keyboard listeners?
1 Answer