I am currently new to Java and I am trying to create a GUI but when i run my code nothing shows up except an empty box only showing the title. Can anyone explain what could possible be wrong?
import javax.swing.* ; import java.awt.event.* ; import java.awt.* ; public class Airplane extends JFrame { private static final int WIDTH = 400; private static final int HEIGHT = 300; private JLabel reserveR; private JTextField reserveTF; private JButton yesB, noB; private CalculateButtonHandler cbhandler; public Airplane() { Container pane = getContentPane(); pane.setLayout(new GridLayout(3,1)); setTitle("Airplane Seating"); setSize(WIDTH,HEIGHT); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); reserveR= new JLabel("To reserve a ticket click Yes or No ", SwingConstants.CENTER); reserveTF = new JTextField(10); yesB = new JButton ("Yes"); cbhandler = new CalculateButtonHandler(); yesB.addActionListener(cbhandler); noB = new JButton ("No"); cbhandler = new CalculateButtonHandler(); noB.addActionListener(cbhandler); pane.add(reserveR); pane.add(yesB); pane.add(noB); pane.add(reserveTF); } private class CalculateButtonHandler implements ActionListener { public void actionPerformed (ActionEvent event) { if ( event.getSource() == yesB) { System.exit(0); } else if ( event.getSource() == noB) { System.exit(0); } } } public static void main(String[] args) { Airplane Airp = new Airplane(); } }