Time Delay using Thread.sleep() for paintComponent(Graphics g) not working as expected
问题 I am making an Animated ProgressBar, in which i used multiple fillRect() method of class javax.swing.Graphics . To put a delay after each rectangle is painted, I am using Thread.sleep(500) method for making a delay, (Suggested by many Forums, for making a delay). The Problem is, instead of making a delay of 0.5sec after each Rectangle box is displayed, it takes the whole delay required by all the rectangles, in the start, and then displays the final image, thats the Progress Bar. Question 1