title: How to use setValueAt, when I change cell in column in JTable
body: <p>I have JTable with rows and columns,
  I need when I edited any cell in column with index 4 -&gt; should changes &quot;VALUE&quot; in the same row, but next column with index 5.
  I have next code, but it doesn't work</p>
  <pre><code>table.getModel().addTableModelListener(new TableModelListener() {
          public void tableChanged(TableModelEvent e) {
              if (table.getSelectedRow()&gt;=0) {
                  try {
                      if (table.getSelectedColumn()==4){
                              
                          table.setValueAt(&quot;VALUE&quot;, 0, 0);
                      }
                  } catch (ArrayIndexOutOfBoundsException ee){
                       ee.printStackTrace();
                  }
              }
           }
      });
  </code></pre>
  <p>It has an error:</p>
  <blockquote>
  <p>at MainFrame$3.tableChanged(MainFrame.java:188) at
  javax.swing.table.AbstractTableModel.fireTableChanged(Unknown Source)
  at javax.swing.table.AbstractTableModel.fireTableCellUpdated(Unknown
  Source) at javax.swing.table.DefaultTableModel.setValueAt(Unknown
  Source) at javax.swing.JTable.setValueAt(Unknown Source)</p>
  </blockquote>
  <p>Because it has infinite cycle.
  Help me, please.</p>
  <p><a href="https://i.stack.imgur.com/QUYWB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QUYWB.png" alt="My Table" /></a></p>