title: JPanel is not showing up
body: <p>I copied the examples straight from the book. The code is supposed to draw a couple things on the JFrame, but nothing shows up(other than the JFrame) Here is the class with the main method</p>
  
  <pre><code>import java.awt.BorderLayout;
  import javax.swing.JFrame;
  
  public class JavaApplication24 {
  
      /**
       * @param args the command line arguments
       */
      public static void main(String[] args) {
      JFrame frame = new JFrame("Window");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
      frame.setSize(480,270);
  
      frame.setVisible(true);
      NewClass panel = new NewClass();
  
      frame.add(BorderLayout.CENTER, panel);
  
      }
  </code></pre>
  
  <p>Here is a subclass of JPanel</p>
  
  <pre><code>import java.awt.Graphics;
  import java.awt.Color;
  import javax.swing.JPanel;
  
  
  public class NewClass extends JPanel {
  
      @Override
      public void paintComponent(Graphics g){
          g.setColor(Color.BLUE);
          g.fillRect(0,0,100,100);
  
          g.setColor(Color.GREEN);
          g.drawRect(50,50,100,100);
  
          g.setColor(Color.RED);
          g.drawString("Hello",200,200);
  
          g.setColor(Color.RED);
          g.fillOval(240,40,100,30);
  
      }
  }
  </code></pre>