title: add jcheckBox to Jtable using GUI
body: <p>after searching in google and stackoverflow and going over some answers i'm still stuck with this problem.</p>
  
  <p>i've jtable and i'm filling it from database(derpy-JDBC).
  <strong>i want add check box to my jtable using GUI</strong>..i have change column type to boolean and add these lines</p>
  
  <pre><code>JCheckBox checkBox = new javax.swing.JCheckBox();
  jTable1.getColumn("status").setCellEditor(new DefaultCellEditor(checkBox));
  </code></pre>
  
  <p>but it doesn't work correctly. 
  this my try</p>
  
  <pre><code>public class showp1 extends javax.swing.JFrame implements  ActionListener  {
  
      /** Creates new form showp1 */
      public showp1() {
          initComponents();
          this.setLocationRelativeTo(null);
          jButton1.addActionListener(this);
          jButton2.addActionListener(this);
        jTextField1.addActionListener(this);
  
      }
  
      /** 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();
          jTable1 = new javax.swing.JTable();
          jButton1 = new javax.swing.JButton();
          jButton2 = new javax.swing.JButton();
          jTextField1 = new javax.swing.JTextField();
  
          setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
          addWindowListener(new java.awt.event.WindowAdapter() {
              public void windowOpened(java.awt.event.WindowEvent evt) {
                  formWindowOpened(evt);
              }
          });
  
          jTable1.setModel(new javax.swing.table.DefaultTableModel(
              new Object [][] {
                  {null, null, null, null},
                  {null, null, null, null},
                  {null, null, null, null},
                  {null, null, null, null}
              },
              new String [] {
                  "id", "area", "location", "status"
              }
          ) {
              Class[] types = new Class [] {
                  java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Boolean.class
              };
  
              public Class getColumnClass(int columnIndex) {
                  return types [columnIndex];
              }
          });
          jScrollPane1.setViewportView(jTable1);
  
          jButton1.setText("jButton1");
  
          jButton2.setText("jButton2");
  
          javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
          getContentPane().setLayout(layout);
          layout.setHorizontalGroup(
              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                      .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE)
                      .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                          .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                              .addComponent(jButton1)
                              .addGap(73, 73, 73)
                              .addComponent(jButton2)
                              .addGap(166, 166, 166))
                          .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                              .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 375, javax.swing.GroupLayout.PREFERRED_SIZE)
                              .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))))
                  .addGap(10, 10, 10))
          );
          layout.setVerticalGroup(
              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                  .addContainerGap()
                  .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)
                  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                  .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
                  .addGap(18, 18, 18)
                  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                      .addComponent(jButton1)
                      .addComponent(jButton2))
                  .addGap(64, 64, 64))
          );
  
          pack();
      }// &lt;/editor-fold&gt;                        
  
  private void formWindowOpened(java.awt.event.WindowEvent evt) {                                  
  
         myDbConnection dbconnect;
          // TODO add your handling code here:
  
  
                 ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();
          try {
  
           dbconnect = new myDbConnection();
              ResultSet resultSet =null;
              resultSet = dbconnect.excuteQuery("SELECT id, area,location, status1 FROM pledges ");
  
  
  
                  while (resultSet.next()){
                     list.add(resultSet.getString(1));
                      list.add(resultSet.getString(2));
                      list.add(resultSet.getString(3));
                      list.add(resultSet.getString(4));
                  }
  
  
          } catch (Exception e) {
              System.out.println(e);
          }
  
          Object[][] record;
  
          int myListCount = list.size()/4;
          record = new Object[myListCount][4];
          int count = 1;
         // JCheckBox checkBox = new javax.swing.JCheckBox();
          for (int ii = 1; ii&lt;=myListCount;ii++) {
              for(int i=1;i&lt;=4;i++){
                  record[ii-1][i-1] = list.get(count-1);
                  count++;
  
              }
  
          }
          //TableColumnModel columnModel = jTable1.getColumnModel();
           //columnModel.getColumn(3).setCellEditor(new DefaultCellEditor(checkBox));
  
          jTable1.setModel(new DefaultTableModel(record, new String[]{"id", "area", "location","status1"}) {
          @Override
       public Class&lt;?&gt; getColumnClass(int columnIndex) {
          if (getColumnName(columnIndex).equals("status1")) {
             return Boolean.class;
          }
          return super.getColumnClass(columnIndex);
       }
    });
  
  
   public static void main(String args[]) {
          java.awt.EventQueue.invokeLater(new Runnable() {
              public void run() {
                  new showp1().setVisible(true);
              }
          });
  } }
  </code></pre>
  
  <p>sorry for this awful code^^"
  thanks in advance</p>