posted 18 years ago
Hiiii,
i just added checkBoxes in a column of my table using the JTableCellRenderer and i want to make a selection of any number
of CheckBoxes i want...For that i made my own CellEditor....the code for which is given below....But i am able to select only one at atime..can anybody help plz........
class JCheckBoxEditor extends JCheckBox implements TableCellEditor
{
JCheckBox checkbox;
JCheckBoxEditor()
{
super();
//checkbox=new JCheckBox();
}
public Object getCellEditorValue() {
// TODO Auto-generated method stub
return checkbox;
}
/* (non-Javadoc)
* @see javax.swing.CellEditor#isCellEditable(java.util.EventObject)
*/
public boolean isCellEditable(EventObject arg0) {
// TODO Auto-generated method stub
return true;
}
public boolean shouldSelectCell(EventObject arg0) {
// TODO Auto-generated method stub
return true;
}
public boolean stopCellEditing() {
// TODO Auto-generated method stub
return true;
}
public void cancelCellEditing() {
// TODO Auto-generated method stub
}
public void addCellEditorListener(CellEditorListener arg0) {
// TODO Auto-generated method stub
}
public void removeCellEditorListener(CellEditorListener arg0) {
// TODO Auto-generated method stub
}
public Component getTableCellEditorComponent(JTable arg0, Object arg1, boolean arg2, int arg3, int arg4) {
// TODO Auto-generated method stub
return this;
}