Paul Clapham wrote:It is called whenever Swing decides that the component needs to be repainted. That might happen when you minimize and then restore your application, or temporarily hide it by displaying some other application over it, and so on. You can signal that it needs to be repainted by calling repaint() on the component, but otherwise you aren't in control of the process.
So your code should be prepared to display the correct output every time that paintComponent is called.
cheers helped a lot!(: