Search:

Type: Posts; User: Norm

Search: Search took 0.14 seconds.

  1. Replies
    31
    Views
    2,660

    Re: thread/timer/sound interaction

    Put some logic in the loop in the run method to choose the next time to call the sound method so it is called at the desired times.
    Use class variables to hold information about it and to control it...
  2. Replies
    31
    Views
    2,660

    Re: thread/timer/sound interaction

    When do you want to use the other values in the array?
    The originally posted code used them all at once.
  3. Replies
    31
    Views
    2,660

    Re: thread/timer/sound interaction

    Remove the for loop and replace the i in [i] with a valid value.
  4. Replies
    31
    Views
    2,660

    Re: thread/timer/sound interaction

    That loop takes 13 seconds to execute. Why do you use that loop? What will the sound method do when called 54 times, one time immediately after the other?

    What happens if you remove the for loop...
  5. Replies
    31
    Views
    2,660

    Re: thread/timer/sound interaction

    How can i do it ?
    Are you asking how to call the sound method from the run method?
    Calling one method from another method is a very common thing to do. Your code has many examples of that....
  6. Replies
    31
    Views
    2,660

    Re: thread/timer/sound interaction

    The paint() method is called by the jvm on the its EDT thread in response to a call to repaint()
    You do not need a separate thread for executing paint().
    Can the existing run() method call the...
  7. Replies
    31
    Views
    2,660

    Re: thread/timer/sound interaction

    You should NOT run loops that take 13 seconds to complete in the paint() method.
    What is the loop supposed to do? It should be moved outside the paint() method to another thread where its execution...
  8. Replies
    31
    Views
    2,660

    Re: thread/timer/sound interaction

    The only two print outs that are important were time 3 (just before the loop) and time 5 (just after the loop) from post#15
    The rest are not needed. Not need to post times inside the loop.

    What...
  9. Replies
    31
    Views
    2,660

    Re: thread/timer/sound interaction

    time 5 is the important one.
    What are the times at time3 and time 5?

    Time 4 should print 54 times. What was the last value printed? Compare it to time 3
  10. Replies
    31
    Views
    2,660

    Re: thread/timer/sound interaction

    You computer is MUCH faster than mine. Mine takes 19 seconds to execute that loop.
    The time4 - time3 is 0.2 seconds

    How can that be?


    Can you post the code showing where time 3 and time 4 are...
  11. Replies
    31
    Views
    2,660

    Re: thread/timer/sound interaction

    Now can you do the arithmetic to compute how loop it took for the loop to execute?
    time for loop to execute = end loop time - start loop time

    This is the loop I am talking about:


    for(int...
  12. Replies
    31
    Views
    2,660

    Re: thread/timer/sound interaction

    Use the System class's current time method before and after the loop and take the difference.
  13. Replies
    31
    Views
    2,660

    Re: thread/timer/sound interaction

    You still have not answered this question:
    How long does it take the loop at the end of the paint() method to execute?
    That will be the minimum time between updates to the GUI.
  14. Replies
    31
    Views
    2,660

    Re: thread/timer/sound interaction

    How long does it take the loop at the end of the paint() method to execute? No changes will be made to the GUI while it is executing.


    How do you want the code's execution changed? You need to...
  15. Replies
    31
    Views
    2,660

    Re: thread/timer/sound interaction

    How long does it take the loop at the end of the paint() method to execute? No changes will be made to the GUI while it is executing.
  16. Replies
    31
    Views
    2,660

    Re: thread/timer/sound interaction

    Please edit your post and wrap your code with code tags:


    <YOUR CODE HERE>

    to get highlighting and preserve formatting.


    Where do you use the TImer class? I don't see it in the posted...
Results 1 to 16 of 16