I am new to programming and have just started learning GUI and was wondering why my GUI isn't showing my button, also i want it to exit the application as it is pressed. I'm unsure on what to do next, could someone help me pls :) I would be very greatful.
public class Main implements ActionListener {
public static void GUI(){
JFrame frame = new JFrame();
JPanel panel = new JPanel();
JButton exit = new JButton();
panel.setBorder(BorderFactory.createEmptyBorder(1080, 720, 1080, 720));
panel.setLayout(new GridLayout(0, 1));
exit.setSize(10, 20);
exit.setBounds(100, 400, 100, 600);
frame.add(exit);
frame.add(panel, BorderLayout.CENTER);
//exit.add(exit);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400, 400);
frame.setLocationRelativeTo(null);
frame.setTitle("Gabe's GUI app");
frame.pack();
frame.setContentPane(panel);
frame.setVisible(true);
exit.setVisible(true);
}
public static void main (String[] args) {
GUI();
}
@Override
public void actionPerformed(ActionEvent e) {
}
}