title: How to add buttons inside a cell of jtable and give it action
body: <p>i know this has been answered before but considering im still a newbie i cant figure out a way to give actions and block the cell editing, i have tried it in several ways,i can successfully render the buttons however when i click on it, it edits the cell instead of pressing the button, i know that in order to avoid the cell editing i should create an abstract table and overide this method:</p>
  
  <pre><code>public boolean isCellEditable(int row, int col) {
          //Note that the data/cell address is constant,
          //no matter where the cell appears onscreen.
          if (col &lt; 3) {
              return false;
          } else {
              return true;
          }
      }
  </code></pre>
  
  <p>however im using a default JTable,so this is the code i am using for the Panel and cell renderer:</p>
  
  <pre><code>class PlusMinusCellRenderer extends JPanel implements TableCellRenderer {
  
      public Component getTableCellRendererComponent(
                          final JTable table, Object value,
                          boolean isSelected, boolean hasFocus,
                          int row, int column) {
  
  
              if(column &lt; 3)
              {
               JLabel campo =   new JLabel(value.toString());
  
  
              this.add(campo);
  
              }
              if(column &gt; 2)
              {
  
                   //this is a button
                   this.add(botaoteste);
  
  
  
  
  
              materialtable.revalidate();
              materialtable.repaint();
  
  
              }
              return this;
  
      }
  </code></pre>
  
  <p>and this is the code i am using to retrieve data from sql to the Jtable(I customised the DefaultJTable code)</p>
  
  <pre><code>String[] columnNames={"teste","abc","def"};                 
       Object[][] data = new Object[1][4];
              if(createConnection())
              {
                  try {
                      Statement statemt = conLogin.createStatement();
                      ResultSet rs = statemt.executeQuery("SELECT * FROM Materiais");
                      //ResultSet rs = statemt.executeQuery("SELECT * FROM Materiais");
                      rsmtdata = rs.getMetaData();
  
                      //int columns = rsmtdata.getColumnCount();
                       columnNames = new String[]{rsmtdata.getColumnName(1),rsmtdata.getColumnName(2),rsmtdata.getColumnName(3),"Deletar"};
                       if(rs.next())
                       {
                          data[0][0] = rs.getString(1);
                          data[0][1] = rs.getString(2);
                          data[0][2] = rs.getString(3);
                          data[0][3] = new Boolean(false);
                       }
                       while (rs.next())
                       {
  
                          Object[][] temp = new Object[data.length+1][4];
                          for(int i=0;i &lt; data.length;i++)
                          {
                              for(int j = 0;j &lt; 4;j++)
                              {
                                  temp[i][j] = data[i][j];
                              }
  
                          }
                          temp[data.length][0] = rs.getString(1);
                          temp[data.length][1] = rs.getString(2);
                          temp[data.length][2] = rs.getString(3);
                          temp[data.length][3] = new Boolean(false);
                          data = temp;
  
  
  
                       }
  materialtable = new javax.swing.JTable(data, columnNames);
  materialtable = new javax.swing.JTable(data, columnNames){ 
              public TableCellRenderer getCellRenderer( int row, int column ) {
                  return new PlusMinusCellRenderer();
              }
           };
  
  materialtable.setRowHeight( 32 );
  
                  } catch (SQLException ex) {
                      Logger.getLogger(ProfessorForm.class.getName()).log(Level.SEVERE, null, ex);
                  }
  
                   }
  
  //Create the scroll pane and add the table to it.
  materialtable.setBackground(new java.awt.Color(153, 255, 51));
  
  materialtable.setSelectionBackground(new java.awt.Color(255, 255, 51));
  
  materialtable.setSelectionForeground(new java.awt.Color(255, 102, 0));
  
  
  
  jScrollPane3.setViewportView(materialtable);
  </code></pre>
  
  <p>so to render the button inside the table i based on this thread: 
  <a href="https://stackoverflow.com/questions/2069641/adding-buttons-inside-cell-of-jtable-along-with-data">Adding Buttons inside cell of JTable along with data?</a></p>
  
  <p>my question is very straight forward, how can i disable Row editing(just like the isCellEditable() method usage) and give action to the buttons?
  any help here is greatly appreciated and please take it to consideration im still novice so please detailed information or samples is needed !
  Kind regards,
  Romulo Romero</p>