title: Button is not displayed on JFrame after .setVisible(true) and ActionListener does sometimes not register clicks on buttons
body: <p>To my two questions:</p>
  
  <p>1) The last added Button 9|9 is displayed to big instead of the coded height and width (100 and 100).</p>
  
  <p>2) Further the ActionListener does not always register the cklicked button at the first try, but rather changes the state/color after the second click.</p>
  
  <p>Any suggestions?</p>
  
  <pre><code>static JFrame gui;
  
  public static void main(String[] args) {
      int[] colors = new int[81];
      for (int n=0; n&lt;81; n++) {
          colors[n] = 0;
      }
      setupGUI(colors);
  }
  
  private static void setupGUI(int[] colors) {
      gui = new JFrame("9x9x9 LED-Cube GUI");
      gui.setSize(905, 925);
      gui.setResizable(false);
      gui.setLayout(new BorderLayout());  
      for (int i=0; i&lt;9; i++) {
          for (int b=0; b&lt;9; b++) {
              int bn = b;
              Button br = new Button((i+1) + "|" + (b+1));
              br.setBounds(b*100, i*100, 100, 100);
              gui.add(br);
              br.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent e) {  
                      changeButtonColor(br, colors, bn);
                  }
              });
          }
      }
      gui.setVisible(true);       
  }
  
  public static void changeButtonColor(Button br, int[] colors, int bn) {
      if(colors[bn] == 0) {
          br.setBackground(Color.green);
          colors[bn] += 1;
      }
      else {
          br.setBackground(new Color(240, 240, 240));
          colors[bn] -= 1;
      }
      System.out.println(colors[bn]); //for test purposes to display the state change
  }
  </code></pre>