Java tutorial
//package com.java2s; import javax.swing.DefaultCellEditor; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.table.TableColumn; public class Main { public static void insertComponentInColumn(JTable jTable, int col, JComponent jComponent) { TableColumn sportColumn = jTable.getColumnModel().getColumn(col); if (jComponent instanceof JComboBox) { sportColumn.setCellEditor(new DefaultCellEditor((JComboBox) jComponent)); } else if (jComponent instanceof JCheckBox) { sportColumn.setCellEditor(new DefaultCellEditor((JCheckBox) jComponent)); } else if (jComponent instanceof JTextField) { sportColumn.setCellEditor(new DefaultCellEditor((JTextField) jComponent)); } } }