aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Want to Edit cells in a JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Want to Edit cells in a JTable" Watch "Want to Edit cells in a JTable" New topic
Author

Want to Edit cells in a JTable

SantoshKr Tripathi
Greenhorn

Joined: Apr 21, 2006
Posts: 8
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;
}
 
 
subject: Want to Edit cells in a JTable