You're doing this in the UI thread, which means nothing in the UI has a chance to react to it until the loop has finished... only the last setBounds
call will really have any visible effect.
If you're trying to perform animation, you'll need to use a timer of some description so that you can repeatedly make a small change, wait (without blocking the UI thread) and then make another change etc. (You probably don't want to use setBounds
for that anyway, but that's a slightly different matter.)
Note that you still need to make the changes on the UI thread, as they're UI changes - you just need to let the UI react to the change before you make the next one.
See the tutorial on Swing timers for more information and examples.