title: Jcheckbox inside a column in a JTable
body: <p>I want to create a table where every time a new row is added, a new check box in a certain column will also be added. I've don my research but i still cant find the right answer for my question, and sometimes i find it hard to understand some of the instructions 
  SO here is my problem:</p>
  
  <p>I have added a check box inside the column (the "e")of my table but it doesn't show. The check box only shows if i click it. </p>
  
  <pre><code>package app.ui;
  
  import java.awt.Color;
  import java.awt.Dimension;
  import java.awt.EventQueue;
  
  import javax.swing.JFrame;
  import javax.swing.JLabel;
  import java.awt.Font;
  import java.awt.event.KeyEvent;
  import java.util.List;
  
  import javax.swing.JTable;
  import javax.swing.JScrollPane;
  import javax.swing.table.AbstractTableModel;
  import javax.swing.table.DefaultTableModel;
  import javax.swing.table.TableCellEditor;
  import javax.swing.table.TableColumn;
  import javax.swing.DefaultCellEditor;
  import javax.swing.JTextField;
  import javax.swing.JCheckBox;
  import javax.swing.SwingConstants;
  
  import app.dao.item.impl.ReadItemFromDB;
  import app.model.Item;
  
  public class Inventory {
  
  private JFrame inventoryframe;
  private JTable table;
  private JTextField textField;
  private JCheckBox checkbox;
  /**
   * Launch the application.
   */
  public  void InventoryWindow() {
      EventQueue.invokeLater(new Runnable() {
          public void run() {
              try {
                  Inventory window = new Inventory();
                  window.inventoryframe.setVisible(true);
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      });
  }
  
  /**
   * Create the application.
   */
  public Inventory() {
      initialize();
  
  }
  
  /**
   * Initialize the contents of the frame.
   */
  private void initialize() {
      inventoryframe = new JFrame();
      inventoryframe.setExtendedState(JFrame.MAXIMIZED_BOTH);
      inventoryframe.getContentPane().setBackground(new Color(153, 204, 102));
      inventoryframe.getContentPane().setForeground(new Color(255, 255, 255));
      inventoryframe.getContentPane().setPreferredSize(new Dimension(1365, 747));
      inventoryframe.pack();
      inventoryframe.getContentPane().setLayout(null);
  
      JLabel lblInventory = new JLabel("Inventory Management");
      lblInventory.setBounds(56, 32, 234, 27);
      lblInventory.setFont(new Font("Tahoma", Font.PLAIN, 22));
      inventoryframe.getContentPane().add(lblInventory);
  
      JScrollPane scrollPane = new JScrollPane();
      scrollPane.setBounds(56, 130, 479, 249);
      inventoryframe.getContentPane().add(scrollPane);
  
      table = new JTable();
      table.setShowVerticalLines(false);
      table.setShowHorizontalLines(false);
      table.setShowGrid(false);
      table.setFillsViewportHeight(true);
      table.setModel(new DefaultTableModel(
              new Object[][] {
              },
              new String[] {
                      "t", "e"
              }
              ));
      scrollPane.setViewportView(table);
  
  
      checkbox = new JCheckBox("borrow");
      checkbox.setHorizontalAlignment(SwingConstants.CENTER);
      checkbox.setBounds(360, 63, 97, 23);
  
      TableColumn sportColumn = table.getColumnModel().getColumn(1);
      sportColumn.setCellEditor(new DefaultCellEditor(checkbox));
  
  
      doIt();
  }
  
  public void doIt(){
      DefaultTableModel dtm = (DefaultTableModel) table.getModel();
      dtm.getDataVector().removeAllElements();
      dtm.getColumnClass(0);
      ReadItemFromDB myReader = new ReadItemFromDB();
      List&lt;Item&gt; newItemList = myReader.showItems();
      @Override
       public Class getColumnClass() {
              return getValueAt(0, 1).getClass();
          }
      for (Item myNewItems : newItemList) {
          Object[] rowData = new Object[1];
  
  
          rowData[0] =myNewItems.getItemID();
  
  
  
          dtm.addRow(rowData);
      }
  
      table.updateUI();
  
  
  }
  
  
  
  /*public Boolean getColumnClass(){
      dtm.getValueAt(0, 1).getClass();
      return null;
  
  }*/
  </code></pre>
  
  <p>}</p>