title: The method add(Component) is not applicable for the arguments
body: <p>I am trying to add a panel to my frame, but it keeps giving me one error that I don't seem to understand. </p>
  
  <pre class="lang-none prettyprint-override"><code>Multiple markers at this line
      - Debug Current Instruction Pointer
      - The method add(Component) in the type Container is
        not applicable for the arguments (TestPanel)
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>import javax.swing.*;
  
  public class FrameTest3 {
  
      public static void main(String[] args) {
          TestPanel samplePanel=new TestPanel();
          JFrame sampleFrame = new JFrame();
          sampleFrame.getContentPane().add(samplePanel);
          sampleFrame.setSize(300,200);
          sampleFrame.setVisible(true);
          System.out.println("Done");
      } 
  }
  </code></pre>
  
  <p></p>
  
  <pre><code>import java.awt.*;
  import javax.swing.*;
  
  public class TestPanel extends JPanel {
  
      public void paintComponent(Graphics g) {   
          g.setColor(Color.red);
          g.drawString("hello", 30, 80);
      } 
  }
  </code></pre>