title: paintComponent and super.paintComponent
body: <p>I am new beginner of Java. Here below are two classes, one class extends <code>JComponent</code>, need to override the <code>paintComponent</code> method. Another class extends <code>JPanel</code>, also need to override the <code>paintComponent</code> method. </p>
  
  <p>Why does <code>DrawingPanel</code> class (extend <code>JPanel</code>) need to call <code>super.paintComponent(g)</code> method, but the <code>CollageComponent</code> (extend <code>JComponent</code>) doesn't need to call <code>super.paintComponent(g)</code>?</p>
  
  <p>I am so confused.</p>
  
  <pre><code>public class CollageComponent extends JComponent {
  
      public void paintComponent(Graphics g) {
  
          g.setColor(Color.ORANGE);
          g.fillRect(100, 50, 300, 75);
  
          // inner green fill
          g.setColor(Color.GREEN);
          g.fillOval(300, 75, 100, 75);
  
      }
  }
  
  
  public class DrawingPanel extends JPanel {
  
      public void paintComponent(Graphics g) {
          super.paintComponent(g);
          g.setColor(Color.ORANGE);
          g.fillRect(100, 50, 300, 75);
  
          // inner green fill
          g.setColor(Color.GREEN);
          g.fillOval(300, 75, 100, 75);
  
      }
  }
  </code></pre>