Pausing for animation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thesti
    New Member
    • Nov 2007
    • 144

    Pausing for animation

    hello,

    i have some jbuttons in my frame.

    and i have a recursive method, which will check a certain condition and if satisfied, will move one of the jbuttons location to somewhere else in the frame and then remove the jbutton from the frame, then the process is repeated.

    (since i use null layout for my frame, i can call the setBounds method)

    the problem is, the method will keep running without pausing, so i couldn't see which buttons is moved. how can i pause at the time it moves the jbuttont before removing it from the frame.

    i've tried using the Thread.sleep(10 00). but it didn't work for me. the UI is not updated until the recursive method is over. so, all i see is only the final result.


    how to pause and update the UI?

    Thank you.
Working...