When there is two for() loop, the second one doesn't work
<p>Here are my for() loops :</p>

<pre><code>public void showMovementCase(){
 int movePlusAttack = moveAllowed+attackDistance;
 int twiceMoveAllowed = (moveAllowed)*2;
 for(int i = 0; i &lt;= movePlusAttack*2; i++){
  for(int j = 0; j &lt;= movePlusAttack*2;j++){
   boolean a = movePlusAttack &lt;= j+i &amp;&amp; movePlusAttack &gt;= j-i &amp;&amp; i &lt;= movePlusAttack;
   boolean b = movePlusAttack &lt;= j+i &amp;&amp; movePlusAttack &gt;= i-j &amp;&amp; i &gt; movePlusAttack &amp;&amp; j &lt;= movePlusAttack;
   boolean c = movePlusAttack*3 &gt;= j+i &amp;&amp; movePlusAttack &gt;= j-i &amp;&amp; i &gt; movePlusAttack &amp;&amp;  j &gt;= movePlusAttack;
   if(a || b || c){
    try{
     actionSquare[i][j] = new JLabel();
     actionSquare[i][j].setIcon(redsquare);
     actionSquare[i][j].setBounds(sprite.getX()+(i-movePlusAttack)*16,sprite.getY()+(j-movePlusAttack)*16, 16, 16);
     panel.add(actionSquare[i][j], new Integer(1));
    }
    catch(ArrayIndexOutOfBoundsException e){System.out.println("red :" + e);}
   }
  }
 }
 for(int x = 0; x &lt;= twiceMoveAllowed; x++){
  for(int y = 0; y &lt;= twiceMoveAllowed;y++){
   boolean a = moveAllowed &lt;= y+x &amp;&amp; moveAllowed &gt;= y-x &amp;&amp; x &lt;= moveAllowed;
   boolean b = moveAllowed &lt;= y+x &amp;&amp; moveAllowed &gt;= x-y &amp;&amp; x &gt; moveAllowed &amp;&amp; y &lt;= moveAllowed;
   boolean c = moveAllowed*3 &gt;= y+x &amp;&amp; moveAllowed &gt;= y-x &amp;&amp; x &gt; moveAllowed &amp;&amp;  y &gt;= moveAllowed;
   if(a || b || c){
    try{
     actionSquare[x][y].setIcon(bluesquare);
     System.out.println("Coucou !");
     actionSquare[x][y].addMouseListener(mouse);
     panel.repaint();
     panel.revalidate();
    }
    catch(ArrayIndexOutOfBoundsException e){System.out.println("blue :" + e); }
   }
  }
 }
}
</code></pre>

<p>if <code>this.attackDistance</code> is different of 0, then the second loop doesn't work (it seems to stop at the <code>.setIcon()</code> command).</p>

<p>Do you know a way to fix this ?</p>

<p>Thanks for reading.</p>

<p>Edit: </p>

<p>with :</p>

<pre><code>                try{
                    actionSquare[x][y].setIcon(bluesquare);
                    System.out.println("Coucou !");
[...]
                }
</code></pre>

<p>On the second loop, nothing is printed.</p>

<p>but with :</p>

<pre><code>            try{
                System.out.println("Coucou !");
                actionSquare[x][y].setIcon(bluesquare);
</code></pre>

<p>[...]
                }</p>

<p>"Coucou !" is printed once.
That's why I said that "it seems to stop at the <code>.setIcon()</code> command" I should have said that sooner, sorry.</p>
