title: Using result set to add dynamic JCheckBox
body: <p>I saw this <a href="https://stackoverflow.com/questions/6972182/need-to-add-jcheckbox-in-jtable-dynamically">Need to add JCheckBox In JTable Dynamically</a> but it didn't help at all seeing my situation is similar but I am not sure how to add the <code>JCheckBox</code> after I have take the raw data from my database.</p>
  
  <pre><code>    public void fillAnyTable(ResultSet resultSet, JTable table)throws SQLException{
  
          //Create new table model
          DefaultTableModel tableModel = new DefaultTableModel();
  
          //Retrieve meta data from ResultSet
          ResultSetMetaData metaData = resultSet.getMetaData();
  
          //Get number of columns from metadata
          int columnCount = metaData.getColumnCount();
  
          //Get all column names from metadata and add columns to table
          for (int columnIndex = 1; columnIndex &lt;= columnCount; columnIndex++){
              tableModel.addColumn(metaData.getColumnLabel(columnIndex));
          }
          //this is when I assume I can create a new column but now how to add the checkbox
          tableModel.addColumn("Check");
          //Create Array of Objects with size of Column count from metadata
          Object[] row = new Object[columnCount];
  
          //Scroll through Result Set
          while (resultSet.next()){
              //Get object from column with specific index of result set to array of objects
              for (int i = 0; i &lt; columnCount; i++){
                  row[i] = resultSet.getObject(i+1);
  
              }
              System.out.println(Arrays.toString(row));
              //Now add row to table model with that array of objects as an argument
              tableModel.addRow(row);
          }
          //Now we add the table model to the table
          table.setModel(tableModel);
      }
  }
  </code></pre>
  
  <p><strong>This is what the view looks like</strong></p>
  
  <p><img src="https://i.stack.imgur.com/KJWEK.png" alt="This is what the view looks like"></p>