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

Thread: "DO EVENTS" while looping

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default "DO EVENTS" while looping

    Im sure some of you are familiar with the "DO EVENTS" code in visual basic that allows the program to perform other tasks while in a loop. I am looking for the equivalent in java. Is there a way to tell java to continue doing its thing, allow user input and what not while in a loop.


  2. #2
    Junior Member
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: "DO EVENTS" while looping

    You can see more infoe about the DoEvents here Definition of DoEvents in Visual Basic for Applications

  3. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: "DO EVENTS" while looping

    way to tell java to continue doing its thing, allow user input and what not while in a loop.
    Are you talking about using threads to allow multiple streams of execution to proceed in parallel?
    Put the stuff you want "java to do" in its own thread and let it run in the background leaving the GUI free to handle user input.

  4. #4
    Junior Member
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: "DO EVENTS" while looping

    right well i think more what i was looking for was a thread.yield, but that works to I suppose.

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: "DO EVENTS" while looping

    The Thread class has several methods, yield included.

Similar Threads

  1. "\b" not "back spacing"?
    By frozen java in forum What's Wrong With My Code?
    Replies: 6
    Last Post: December 24th, 2011, 02:53 PM
  2. Replies: 3
    Last Post: December 7th, 2011, 02:03 AM
  3. Replies: 7
    Last Post: August 13th, 2011, 01:22 AM
  4. Java says:"Hello World". I say:"It works!"
    By Davidovic in forum Member Introductions
    Replies: 4
    Last Post: June 29th, 2010, 07:13 AM
  5. "java.lang.NoSuchMethodError: main" and "fatal exception occured."
    By joachim89 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 10th, 2010, 08:35 AM