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 2 of 2

Thread: Timeout method

  1. #1
    Junior Member
    Join Date
    Jun 2011
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Timeout method

    Hi All,

    I want to execute a method for a given length of time and then stop it; At the moment my method execution is controlled by a boolean var like that

    if (start) method();

    so what I wanto to achieve is to keep value start true for a given time and then switch to false. How to do it quite easily?


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Timeout method

    The Swing Timer class could be used to call a method to set the boolean to false after a given length of time.

Similar Threads

  1. Replies: 1
    Last Post: May 1st, 2011, 10:13 AM
  2. Can you pass parameters from one method into another method?
    By u-will-neva-no in forum Java Theory & Questions
    Replies: 2
    Last Post: April 14th, 2011, 07:46 AM
  3. Help with toString method and an addObject method?
    By Camisado in forum What's Wrong With My Code?
    Replies: 2
    Last Post: February 12th, 2011, 07:00 AM
  4. Can i call init() method in destroy method.?
    By muralidhar in forum Java Servlet
    Replies: 1
    Last Post: October 22nd, 2010, 11:18 AM
  5. Session Timeout in LDAP
    By retail_deepa in forum Java Servlet
    Replies: 0
    Last Post: August 4th, 2009, 03:26 AM