• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Timeout

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic