repaint() Method in Java
问题 I am playing around with the Java graphics class a little bit and I was just wondering--when is it necessary to call the method repaint() ? I tried commenting it out and it didn't seem to affect my output GUI. I've seen it used a lot in Java GUI code that I've read, though. Would anyone mind explaining when to use it and when not to use it? 回答1: The repaint() refreshes the view (component), so whenever you make any change on the component, you must call it. For instance, if you rotate the