Timing out a login for a Java Application
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mark_Strivens
Posted On:   Tuesday, March 20, 2001 08:46 AM

I have a java application (JDK 1.3, Swing) where the user is required to login. It works well but I would like to implement an auto logout feature (i.e. to trigger a method after a certain amount of non use) - I presume I would install a listener on the base JFrame for keyboard and mouse clicks? The problem is how do I ensure that any mouse and keyboard events occuring from components located on the base JFrame (e.g. JButton, JTabbedPane) are propagated to the listener for that frame? Or is there a better way to do it? Is there a listener that can be implemented that will respond to any events from a range of components.    More>>

I have a java application (JDK 1.3, Swing) where the user is required
to login. It works well but I would like to implement an auto logout
feature (i.e. to trigger a method after a certain amount of non use)
- I presume I would install a listener on the base JFrame for keyboard
and mouse clicks?

The problem is how do I ensure that any mouse and keyboard events
occuring from components located on the base JFrame (e.g. JButton,
JTabbedPane) are propagated to the listener for that frame?

Or is there a better way to do it? Is there a listener that can be
implemented that will respond to any events from a range of
components.

   <<Less

Re: Timing out a login for a Java Application

Posted By:   Christopher_Schultz  
Posted On:   Tuesday, April 3, 2001 07:52 AM

Instead of catching every possible event and treating that as the 'usage' criteria, why not clearly define activities which are considered 'active' ones?



Certainly, moving the mouse over the canvas shouldn't be a valid way to keep yourself logged-in.



If you clearly define which operations should update your usage timestamp, you should be able to put that kind of logic directly in your (already existing) event-handlers. This will make your UI code maintenance more manageable. It will also reduce the number of hacks you will need to make sure that every UI event is caught and updates the timeout.



-chris
About | Sitemap | Contact