so today's question on my mind is this. I'm trying to develop a trivia game and to do so I need to add 2 JPanels to the screen. The problem, only one shows up, specifically the first one initialized. I checked out some other similar questions on this site but to no avail. Any ideas on how to fix this? questionPanel and anotherPanel both are classes that extend JPanel. Why won't both show up at the same time?
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Trivia extends JFrame{
questionPanel qp;
private JButton q1,q2,q3,q4;
public Trivia(){
setSize(600,600);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
qp = new questionPanel();
add(qp,BorderLayout.SOUTH);
anotherPanel ap = new anotherPanel();
add(ap,BorderLayout.NORTH);
}
public static void main(String args[]){
Trivia t = new Trivia();
}
}