title: Create animation JButton Grid java
body: <p>How can I do a similar drop down animation on <code>gridlayout</code>?</p>
  
  <p>I'm trying to do the game Connect 4 with swing lib.</p>
  
  <p>Why this doesn't work?</p>
  
  <pre><code>private class ButtonListener implements ActionListener {
      public void actionPerformed(ActionEvent event) {
          JButton bottone = event.getSource();
          for (int i = 0; i &lt; 6; i++) {
              for (int j = 0; j &lt; 7; j++) {
                  if (bottone == Grid[i][j]) {
                      animation(i, j);
                      Grid[i][j].setBackground(new Color.RED);
                      Grid[i][j].setEnabled(false);
                      if (i &gt; 0) {
                          Grid[(i - 1)][j].setEnabled(true);
                      }
                  }
              }
  
          }
      }
  }
  
  private void animation(int row, int column) {
      try {
          for (int i = 0; i &lt; row; i++) {
              Grid[i][column].setBackground(new Color.RED);
              revalidate();
              repaint();
              Thread.sleep(100);
              Grid[i][column].setBackground(new Color.WHITE);
              revalidate();
              repaint();
          }
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>Is it possible do something like this?</p>