Is calling repaint from paintComponent a good practice
问题 For some UI components in our application, we override paintComponent , which under some conditions "recursively" calls itself by invoking repaint . We use this approach to achieve high refresh rate of animations in the component. For instance, a progress bar we use looks something like: public class SimpleProgressBar extends JPanel { private boolean inProgress; .... @Override protected void paintComponent(Graphics g) { if (inProgress) { paintBar(g); repaint(); } else { doSomeOtherThings(); }