title: How to add JCheckBox in JTable?
body: <p>First of all i apologize for my english neglect that i will explain all my problem.</p>
  
  <p>First i want JCheckBox in the JTable i have.</p>
  
  <p>I am retrieving student id and student name from database in column index 0 and 1. I want third column should be Absent/Present which will initially take whether student is present or absent by JCheckbox Value.</p>
  
  <p>Here my code for JTable values :</p>
  
  <p><strong>Attendance.java</strong></p>
  
  <pre><code>/*
   * To change this template, choose Tools | Templates
   * and open the template in the editor.
   */
  package shreesai;
  
  import java.sql.Connection;
  import java.sql.PreparedStatement;
  import java.sql.ResultSet;
  import java.util.Vector;
  
  /**
   *
   * @author Admin
   */
  public class Attendance{
  
      Connection con = Connectdatabase.ConnecrDb();
      public Vector getEmployee()throws Exception
      {
  
          Vector&lt;Vector&lt;String&gt;&gt; employeeVector = new Vector&lt;Vector&lt;String&gt;&gt;();
  
          PreparedStatement pre = con.prepareStatement("select studentid,name from student");
          ResultSet rs = pre.executeQuery();
          while(rs.next())
          {
  
              Vector&lt;String&gt; employee = new Vector&lt;String&gt;();
              employee.add(rs.getString(1)); //Empid
              employee.add(rs.getString(2));//name
              employeeVector.add(employee);
  
          }        
          if(con!=null)
          con.close();
          rs.close();
          pre.close();
  
          return employeeVector;
      }
  }
  </code></pre>
  
  <p><strong>THIS CODE FOR TAKING VALUES FROM DATABASE SAVING IT INTO VECTOR</strong> </p>
  
  <p><strong>AttendanceGUI.java</strong></p>
  
  <pre><code>/*
   * To change this template, choose Tools | Templates
   * and open the template in the editor.
   */
  package shreesai;
  
  import static java.awt.Frame.MAXIMIZED_BOTH;
  import java.util.Vector;
  import javax.swing.JOptionPane;
  
  /**
   *
   * @author Admin
   */
  public class AttendanceGUI extends javax.swing.JFrame {
  
      /**
       * Creates new form AttendanceGUI
       */
      private Vector&lt;Vector&lt;String&gt;&gt; data;
      private Vector&lt;String&gt; header;
      public AttendanceGUI() throws Exception {
  
          this.setLocationRelativeTo(null);
          setExtendedState(MAXIMIZED_BOTH);
          Attendance att = new Attendance();
          data = att.getEmployee();
  
          header = new Vector&lt;String&gt;();
          header.add("Student ID");
          header.add("Student Name");
          header.add("Absent/Present");
          initComponents();
      }
      /**
       * This method is called from within the constructor to initialize the form.
       * WARNING: Do NOT modify this code. The content of this method is always
       * regenerated by the Form Editor.
       */
      @SuppressWarnings("unchecked")
      // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt;                          
      private void initComponents() {
  
          jScrollPane1 = new javax.swing.JScrollPane();
          AttendanceT = new javax.swing.JTable();
  
          setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  
          AttendanceT.setModel(new javax.swing.table.DefaultTableModel(
              data,header
          ));
          jScrollPane1.setViewportView(AttendanceT);
  
          javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
          getContentPane().setLayout(layout);
          layout.setHorizontalGroup(
              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(layout.createSequentialGroup()
                  .addContainerGap()
                  .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                  .addContainerGap(397, Short.MAX_VALUE))
          );
          layout.setVerticalGroup(
              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(layout.createSequentialGroup()
                  .addContainerGap()
                  .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                  .addContainerGap(89, Short.MAX_VALUE))
          );
  
          pack();
      }// &lt;/editor-fold&gt;                        
  
      /**
       * @param args the command line arguments
       */
      public static void main(String args[]) {
          /* Set the Nimbus look and feel */
          //&lt;editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "&gt;
          /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
           * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
           */
          try {
              for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                  if ("Nimbus".equals(info.getName())) {
                      javax.swing.UIManager.setLookAndFeel(info.getClassName());
                      break;
                  }
              }
          } catch (ClassNotFoundException ex) {
              java.util.logging.Logger.getLogger(AttendanceGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (InstantiationException ex) {
              java.util.logging.Logger.getLogger(AttendanceGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (IllegalAccessException ex) {
              java.util.logging.Logger.getLogger(AttendanceGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (javax.swing.UnsupportedLookAndFeelException ex) {
              java.util.logging.Logger.getLogger(AttendanceGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          }
          //&lt;/editor-fold&gt;
  
          /* Create and display the form */
          java.awt.EventQueue.invokeLater(new Runnable() {
              public void run() {
                  try{
                      new AttendanceGUI().setVisible(true);
                  }
                  catch(Exception e){
                      JOptionPane.showMessageDialog(null,e);
                  }
              }
          });
      }
      // Variables declaration - do not modify                     
      private javax.swing.JTable AttendanceT;
      private javax.swing.JScrollPane jScrollPane1;
      // End of variables declaration                   
  }
  </code></pre>
  
  <p>My problemis that I can't add a <code>JCheckBox</code> in front of every student I have seen <code>JTabel</code> model, renderer and all but I don't get anything. I want something like this...</p>
  
  <p><img src="https://i.stack.imgur.com/Rtokk.jpg" alt="enter image description here"></p>
  
  <p>I've search for this stuff for a couple of weeks but did bot get anything suitable for this</p>