title: java jtable removeRow : java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
body: <p>I'm removing a row in my JTable and i have this Exception : IndexOutOfBoundsException: Index: 1, Size: 1". </p>
  
  <p>This is my TableModel Classe: </p>
  
  <pre><code>public Class MyTableModel extends AbstractTableModel {
  private static final long serialVersionUID = -912060609250881296L; 
  private ResultSet rs; 
  private int rowCount; 
  private int columnCount; 
  private ArrayList&lt;Object[]&gt; data=new ArrayList&lt;Object[]&gt;(); 
  private ArrayList&lt;TableModelListener&gt; listeners = new ArrayList&lt;TableModelListener&gt;();  
  
  public TableModelMicrosite(ResultSet _rs) throws Exception 
  {  
      setRS(_rs); 
  } 
  
  public void setRS(ResultSet _rs) 
          throws Exception 
          { 
      this.rs=_rs; 
      ResultSetMetaData metaData=_rs.getMetaData(); 
      rowCount=0; 
      columnCount=metaData.getColumnCount(); 
      while(_rs.next()){ 
          Object[] row=new Object[columnCount]; 
          for(int j=0;j&lt;columnCount;j++){ 
              row[j]=_rs.getObject(j+1); 
          } 
          data.add(row); 
          rowCount++; 
      } 
          } 
  public boolean isCellEditable(int rowIndex, int columnIndex){ 
      return false; 
  } 
  public void addTableModelListener(TableModelListener l)   
  {   
      if (listeners.contains(l))   
          return;   
      listeners.add(l);   
  }   
  
  
  public void setValueAt(Object value, int rowIndex, int columnIndex)   
  {   
      data.get(rowIndex)[columnIndex] = value;  
  
      TableModelEvent tabModEvent = new TableModelEvent(this, rowIndex,   
              rowIndex, columnIndex, TableModelEvent.UPDATE);    
      for (TableModelListener l: listeners)   
          l.tableChanged(tabModEvent);   
      fireTableCellUpdated(rowIndex, columnIndex); 
      System.out.println("Changed :  " + value); 
  }   
  
  public int getColumnCount(){ 
      return columnCount; 
  } 
  
  public int getRowCount(){ 
      return rowCount; 
  } 
  
  public Object getValueAt(int rowIndex, int columnIndex){ 
       Object[] row=(Object[]) data.get(rowIndex); 
      System.out.println("rowIndex : "+rowIndex);     System.out.println("columnIndex : "+columnIndex);  
      return row[columnIndex]; 
       // return data[rowIndex][columnIndex]; 
  
  } 
  
  public String getColumnName(int columnIndex){ 
      try{ 
          ResultSetMetaData metaData=rs.getMetaData(); 
          return metaData.getColumnName(columnIndex+1); 
      }catch(Exception e){ 
          e.printStackTrace(); 
          return null; 
      } 
  }    
  
  public void addRow(Object[] row) { 
      data.add(0, row); 
      fireTableRowsInserted(0, 0); 
  } 
  
  public void removeRow(int  selectedrow) {   
          data.remove(selectedrow) ; 
               fireTableRowsDeleted(selectedrow, selectedrow);   
  } 
  </code></pre>
  
  <p>}</p>
  
  <p>And this is how i call my removeRow()  method in my principal Class :</p>
  
  <pre><code>table = new JTable(monDataModel()); 
  int [] row = table.getSelectedRows();  
  table.clearSelection(); 
  
     List&lt;Integer&gt; selectedModelRows = new LinkedList&lt;Integer&gt;(); 
     for (int i = 0; i &lt; row.length; i++) { 
         selectedModelRows.add(table.convertRowIndexToModel(row[i])); 
     } 
     Collections.sort(selectedModelRows, Collections.reverseOrder()); 
  
     for (int selectedModelRow : selectedModelRows) { 
         ((TableModelMicrosite) table.getModel()).removeRow(selectedModelRow); 
         ((TableModelMicrosite) table.getModel()).fireTableRowsDeleted(selectedModelRow, selectedModelRow); 
     }
  </code></pre>
  
  <p>I think there is a issue with the   getValue() method in the TableModel,  but i don't know  what is the mistake.  </p>
  
  <p>Can you  help me please ?   Thanks a lot ! </p>