In the TopPanel class you just add the lable into another JPanel object panel, and this panel is not added into TopPanel. I made a little change in your TopPanel class. (You can change the layout if needed )
import javax.swing.*;
import java.awt.*;
public class TopPanel extends JPanel {
public TopPanel() {
JLabel Crse = new JLabel("Course Info");
Crse.setFont(new Font("Serif", Font.PLAIN, 14));
add(Crse);
}
}
use this TopPanel in CourseGui
JPanel topPanel = new TopPanel();
Please try accept if it worked
You can alsoe use
JPanel topPanel = new JPanel();
JLabel Crse = new JLabel("Course Info");
Crse.setFont(new Font("Serif", Font.PLAIN, 14));
topPanel.add(Crse);