JButtons don't imediatly change on mouse event
<p>I'm using the java swing library to develop a board game called DAO. </p>

<p>The problem is that after the human player makes its move, by clicking on the JButton with the piece image that he wants to play, I call the computer AI routine but inside the mouse event function. By doing this only when the function returns, the computer ends its turn, do the JButtons refresh their Images (setIcon comes in). </p>

<p>I'd like to know how can I force the JButtons to change their image at the moment they are clicked and not only when the mouse event function ends (as I need to handle data inside it).</p>

<p>I've tried all of this</p>

<pre><code>                    myButtons[i][j].setIcon(xIcon);
                    myButtons[i][j].revalidate();
                    myButtons[i][j].repaint();
                    myButtons[i][j].validate();
</code></pre>

<p>None worked.</p>

<p>Thx in advance</p>
