• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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;
}
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic