repaint() in Java doesn't “re-paint” immediately?

前端 未结 3 1053
余生分开走
余生分开走 2020-12-15 13:25

I have a code like that:

// In MyPanel.java
public void paintComponent(Graphics g)
{
    super.paintComponent(g);
    // Draw something
    mypanel_count++;
         


        
3条回答
  •  难免孤独
    2020-12-15 13:47

    understand that you do not have complete control over if or when paint(...) get's called, and that repaint() calls are only a suggestion to the JVM to paint. If too many repaint() requests come in and they stack up as yours are doing, then they will be combined

    refer : https://stackoverflow.com/a/13256847/1423083

提交回复
热议问题