Jave - paintComponent random only once : <p>I'm just started to learn Java.</p>

<p>I'm trying to build a program that draw in the JPanel random shapes once, and it doesn't change' even in resizing.
If the user wants (by a Dialog box) the shapes will repaint all over again.</p>

<p>How can I do that?</p>

<p>The number of shapes or they color is not fixed and can be change.</p>

<p>Thanks!</p>
