title: Several JButtons store values in one array?
body: <p>I'm making a lottery program and what I want is to have several JButtons on-screen that when clicked on store the numbers in an array. Here's my code so far, I'm a beginner so I have no idea what to do next, any help is appreciated. Thanks!</p>
  
  <pre><code>    b1 = new JButton();
      b1.setLocation (5, 5);
      b1.setSize (50, 50);
      //b1.setText ("1");
      b1.setIcon(new ImageIcon("jedan.png"));
      c.add(b1);
  
      b2 = new JButton();
      b2.setLocation (60, 5);
      b2.setSize (50, 50);
      b2.setText ("2");
      c.add(b2);        
  
      b3 = new JButton();
      b3.setLocation (115, 5);
      b3.setSize (50, 50);
      b3.setText ("3");
      c.add(b3);
  </code></pre>