title: Java Netbeans override paint() method in a JPanel
body: <p>Hi I'm a newbie programmer<br>
  I want to develop a Java program's GUI using Netbeans IDE</p>
  
  <p>Using Netbeans GUI Builder,<br>
  First, I create a new JFrame Form<br>
  Then, I add a JPanel from the toolbar/palette  </p>
  
  <p>Question is,<br>
  How can I override the <code>paint()</code> function of the newly created <code>JPanel</code> ?</p>
  
  <p>I want to draw a background and some spheres inside the <code>JPanel</code>,<br>
  I tried using <code>getGraphics()</code> function to paint and draw, it does the job, but it won't draw anymore when I call <code>repaint()</code>  </p>
  
  <p>Should I create a new class implementing <code>JPanel</code> or <code>JComponent</code>, with my custom <code>paint()</code> function, instead ?<br>
  (If it so, how can I do it with Netbeans GUI Builder?)</p>
  
  <p>Similar Question :  </p>
  
  <blockquote>
    <p><a href="https://stackoverflow.com/questions/8631670/how-to-use-jpanel-with-paint-or-repaint">how to use jpanel with paint (or repaint)</a>  </p>
  </blockquote>
  
  <p>(but it doesn't use Netbeans GUI Builder)</p>