how is paint() running without being called in the main method?

前端 未结 3 675
余生分开走
余生分开走 2020-12-06 02:56

This is a beginner question for java graphics using the awt package. I found this code on the web to draw some simple graphics.

import java.awt.*;
public cla         


        
3条回答
  •  执笔经年
    2020-12-06 03:33

    Actually you never invoke paint mathod yourself. It gets called automatically whenever the content pane of your frame needs to be repainted. It happens when your frame is rendered for the first time, resized, maximized (after being minimzed), etc.

提交回复
热议问题