Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8370619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:57:23+00:00 2026-06-09T13:57:23+00:00

I have a fairly large swing application I’m maintaining and I have to add

  • 0

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 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T13:57:25+00:00Added an answer on June 9, 2026 at 1:57 pm
    // the event mask; adjust as desired
    long eventMask = 
        AWTEvent.KEY_EVENT_MASK |
        AWTEvent.MOUSE_EVENT_MASK |
        AWTEvent.MOUSE_MOTION_EVENT_MASK |
        AWTEvent.INPUT_METHOD_EVENT_MASK;
    
    // install a listener for receiving global events
    Toolkit.getDefaultToolkit().addAWTEventListener(yourListenerInstance, eventMask);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fairly large application that uses WPF for its user interface. I
I have a fairly large C++ application (on Windows, no other platforms planned), which
I have a fairly large MVC3 application, of which I have developed a small
I have a fairly large js lightbox gallery and an hasty user can click
I have a fairly large application, where my data access strategy has always been
We have fairly large C++ application which is composed of about 60 projects in
We have a fairly large Windows based 1.1 .NET application that we are considering
I have a fairly large python 2.6 application with lots of print statements sprinkled
I have a fairly large Excel csv file that I need to add and
I have a fairly large dynamic website, whose user interface is written using XHTML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.