• Post Reply Bookmark Topic Watch Topic
  • New Topic

Timeout

 
Tony White
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a client/server java application. I need to timeout the client application after a period of time of NON usage. I have no idea how to do this. Does anyone have a suggestion?
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Implement a timer system that kills the connection after a certain time. Then add a MouseMotionListener and/or a KeyListener to your main frame. Every time the appropriate methods are called (mouseMoved, mouseClicked, keyDown, etc) reset the timer back to zero.
 
Tony White
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your response. Do you have any examples that I can use? I'm not sure how to start coding this. I'm having trouble thinking about how to code the timing system.
The client is a Java GUI using Swing classes and AWT. If that helps.
[ September 14, 2005: Message edited by: Tony White ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Stuart Gray:
Implement a timer system that kills the connection after a certain time. Then add a MouseMotionListener and/or a KeyListener to your main frame. Every time the appropriate methods are called (mouseMoved, mouseClicked, keyDown, etc) reset the timer back to zero.


Setting KeyListeners on the main frame won't work. Once focus goes to another component the main frame stops listening. I'd expect MouseListeners to work much the same way. See here
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!