Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Action if window is inactive.

  1. #1
    Member
    Join Date
    Sep 2011
    Posts
    46
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Action if window is inactive.

    Hi,
    How would i make an if function that says if a jframe is inactive for X seconds do this. So for example, if jframe is inactive for 10 seconds System.out.print ("Pay attention to me");

    Thanks
    Joel


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Action if window is inactive.

    No offense, but it sounds like an annoying application. You will most likely need to log each 'action' that occurs, and have a parallel thread/Timer that fires periodically and checks the last 'action'. It is up to you to define what you mean by action - for example this could be just registered listeners, or registered WindowListeners/ComponentListeners/etc...

  3. #3
    Member
    Join Date
    Sep 2011
    Posts
    46
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Action if window is inactive.

    That was just an example, the use of it in my application will be to change a picture from a happy face to a bored face. Im not making an application that will constantly irritate you Ok, i will let you know how it goes. Thankyou

Similar Threads

  1. Need Help for Robot class even on inactive window
    By jamsubzero in forum Java Theory & Questions
    Replies: 3
    Last Post: March 5th, 2011, 09:29 PM
  2. Craating non active window ,and inputing to the non active window.
    By java-beginner in forum Java Theory & Questions
    Replies: 0
    Last Post: February 25th, 2011, 10:13 PM
  3. Action Listener
    By Suzanne in forum What's Wrong With My Code?
    Replies: 7
    Last Post: May 29th, 2010, 10:50 AM
  4. Action Listener
    By kray66 in forum AWT / Java Swing
    Replies: 2
    Last Post: April 19th, 2010, 03:26 PM
  5. Need Help Action Listener....
    By vhizent23 in forum AWT / Java Swing
    Replies: 2
    Last Post: October 9th, 2009, 01:46 PM