title: Getting Labels a name with a label
body: <p>This panel class is suppose to print out "Course Info" Yet when I do try to print it out on the GUI, the gui frame shows up but not the Panel. So I feel the panel code is the problem, how to get the "Course Info" to appear? And if the label is working correctly, why when I post the label to the gui, it just shows another blank Frame?</p>
  
  <p>Panel:</p>
  
  <pre><code>import javax.swing.*;
  import java.awt.*;
  
  
  public class TopPanel extends JPanel {
  
      public TopPanel(){
          JPanel panel = new JPanel();
          JLabel Crse = new JLabel("Course Info");
          Crse.setFont(new Font("Serif", Font.PLAIN, 14));
          panel.add(Crse);
  
      }
  }
  </code></pre>
  
  <p>GUI code:</p>
  
  <pre><code>import javax.swing.*;
  import java.awt.*;
  
  public class CourseGUI extends JFrame {
      public CourseGUI()
      {
  
          super("CourseGUI Frame");
  
  
          JPanel topPanel = new JPanel();
          topPanel.setBackground(java.awt.Color.WHITE);
          Dimension d = new Dimension(800,600);
  
          topPanel.setPreferredSize(d);
  
          this.setLayout(new BorderLayout());
  
          this.add(topPanel, BorderLayout.NORTH);
  
          this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
          this.setSize(800,600);
          //JPanel tp = new TopPanel();
          //this.add(tp.BorderLayout.North);
  
  
          JPanel panel = new TopPanel();
         this.add(panel, BorderLayout.SOUTH);
  
  
          this.setVisible(true);
      }
      public static void main(String[] args)
      {
          new CourseGUI();
      }
  
  }
  </code></pre>