2

repaint()カスタムで関数を呼び出すと、正しくJPanel再実行されると理解していpaintComponent(Graphics g)ますか? それとも全体を再作成しJPanelますか?助けてくれてありがとう。

4

1 に答える 1

4

+1 to trashgod. The docs for repaint() state:

Repaints this component.

repaint() causes AWT to invoke update() (for heavyweight components which will then invoke paint()) or paint() (for lightweight components) on EDT which in-turn invokes paintComponent(...).

so no it is not re-created every time repaint() is called.

Reference:

于 2012-10-20T22:42:42.463 に答える