title: JLabel not updating
body: <p>so thanks for looking at my question,Well anyways im trying to make a cookie clicker clone (if you could call it that) where you click the button and the JPanel updates, unfortunately the JPanel doesn't update and I just cant find an answer anywhere else, Any help is valuable help, thank you! Here is my code:</p>
  
  <pre><code>    public int numCookies;
  
  public main(){
  
      //JButton
      JButton click = new JButton("Click");
      click.setLayout(null);
      click.setLocation(50, 50);
      click.setSize(80, 50);
      click.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent arg0){
              numCookies = numCookies + 1;
          }
      });
  
  //JLabel
  JLabel cookies = new JLabel();
  cookies.setLayout(null);
  cookies.setText("Cookies:" + numCookies);
  cookies.setLocation(480/2,10);
  cookies.setSize(200, 50);
  
      //JPanel
  JPanel panel = new JPanel();
      panel.setLayout(null);
      panel.setLocation(10, 0);
      panel.setSize(260, 30);
      panel.add(click);
      panel.add(cookies);
  
      //JFrame
      JFrame frame = new JFrame("Cookie clicker!");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setSize(600, 480);
      frame.setLocationRelativeTo(null);
      pack();
      frame.setVisible(true);
      frame.add(panel);
  
  }
  
  public static void main(String args[]){
  
      new main();
  
  }
  </code></pre>