Good day! I'm a complete noob in GUI programming so I wanted to know whats wrong with my code. I can compile the program without a problem but when the GUI appears none of my components appear. Any help would be appreciated. thanks!
import javax.swing.*; import java.awt.event.*; import java.awt.*; public class MenuList { private JFrame page1; private JPanel panel; private JButton burger; private JButton rice; private JLabel label; public MenuList() { gui(); } public void gui() { page1 = new JFrame("FAST FOOD"); page1.setVisible(true); page1.setSize(600,400); page1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); panel = new JPanel(new BorderLayout()); //BUTTONS burger = new JButton("Burger"); burger.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, "BURGER"); } }); rice = new JButton("Rice"); label = new JLabel("ORDER HERE"); //END (BUTTONS) //LAYOUT GroupLayout layout = new GroupLayout(panel); layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup(layout.createSequentialGroup() .addComponent(burger) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)) ); //END (LAYOUT) } public static void main(String[] args) { new MenuList(); } }