• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Want to Edit cells in a JTable

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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;
}
 
reply
    Bookmark Topic Watch Topic
  • New Topic