title: java: how to select only one cell in a jtable and not the whole row
body: <p>in a jTable, I want when a user clicks on a cell, this sentence to be printed on the screen :</p>
  
  <pre><code>I am cell in row X and column Y
  </code></pre>
  
  <p>where x and Y are the row and column of the clicked cell.
  But what I am getting is : when I click for example the cell in row 1 and column 4
  I get the following :</p>
  
  <pre><code>I am cell in row 1 and column 0
  I am cell in row 1 and column 1
  I am cell in row 1 and column 2
  ....
  I am cell in row 1 and column N  ( N = number of columns)
  </code></pre>
  
  <p>i.e. the whole row is selected.</p>
  
  <p>this is the code :</p>
  
  <pre><code>public class CustomTableCellRenderer extends DefaultTableCellRenderer{
  
  public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
  {
  
      Component cell = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
  
              if(isSelected) System.out.println("I am cell in row "+row+" and column "+column);
  
  
  
      return cell;
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Thanks for any help.</p>