why is my code executing paintComponent(Graphics page) twice?

流过昼夜 提交于 2019-11-28 14:33:49
dogbane

It printed out twice for me too.

However, I don't think it is cause for concern. Swing decides when things need to be repainted. For example, if you resize a window or minimise/maximise, Swing will repaint. It might be dependent on the OS/hardware you are running on.

You should write your code so that it is robust enough to handle multiple calls to repaint.

Please see this SO question too: paintComponent is executing twice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!