Counter of lines in JTable
<p>In the following code, I browse a table and count lines containing "ble", "cle", "tion"; my counters print the expected values at x=1, but at x=2 and 3 the value of counters is wrong.</p>

<p>I'm working with JTable and trying to count on each value of x the number of lines containing the above strings.</p>

<p>Expected values:<br>
x=1: counter1=5 counter2=5 counter3=6<br>
x=2: counter1=10 counter2=10 counter3=6<br>
x=3: counter1=20 counter2=17 counter3=6</p>

<pre><code>int counter1 = 0;
int counter2 = 0;
int counter3 = 0;
for (int x = 1; x &lt; 4; x++)
{
  myTable.goToValue(x);               
  for (int i = 0; i &lt; myTable.getRowCount(); i++)
  {    
    if (myTable.getIcon(i, 0).matches("blue.gif"))
    {                                   
      if (myTable.getRowValue(i, 1).contains("ble."))
      {
        counter1++;
      }    
      if (myTable.getRowValue(i, 1).contains("cle."))
      {    
        counter2++;
      }
      if (myTable.getRowValue(i, 1).contains("tion."))
      {
        counter3++;
      }
    }
  }
  System.out.println(counter1);
  System.out.println(counter2);
  System.out.println(counter3);
}
</code></pre>
