Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

is it possible to capture all events?  RSS feed

 
suri
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my application i have JFrame which contains different panels with other panels on it. these panels contain buttons, text fields, combo boxes, tables and other swing componets. this frame contains scrollpanes,panels etc.
i want to track all the events happening on this application in one place.
is there any way i can capture all the events occured in buttons, tables, panels and other swing components in the parent container(JFrame)?
i tried processEvent method, but its not working for all the componets.
i tried method processEvent(AWTEvent e) on frames & panels.
this method should be executed whenever there is an event in frame or its children(panels in frame, buttons etc). this method is working fine in most of the cases, but still its not working on some panels , buttons etc...

what exactly i want to do is... :
User has to log in our application using user name & password.
after user logs in i want to keep track of user activity on our application(only to know whether user is active or not). if user is idle for some(no activity by mouse or key board on application) it should time out and user should log in again.
for this i want to track all the events happening in application.
how to track the user activity in my application as a whole? it would be difficult to add listeners to each and every component.
i would appriciate if any one can throw some light on this issue.
can please suggest me some good books on event handling in swing..

Thanks...
suri...
 
Sean MacLean
author
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Suri",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in again with a new name which meets the requirements.
Thanks.
Sean
 
Colleen Casey
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a similar problem but with wanting to set an hourglass cursor whenever an event in the application took over x amount of time. I didn't want to have a listener attached to every field. I found the answer by customizing the EventQueue. Most books don't even discuss the EventQueue in detail. I found my info in a JavaWorld article (see http://www.javaworld.com/javatips/jw-javatip87.html). Just make sure you have at least JDK 1.2.2. Sun does have a section on the EventQueue in the tutorial but the last time I looked,it was under construction. Hope this helps.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!