Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!
  • 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
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

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;
}
 
sunglasses are a type of coolness prosthetic. Check out the sunglasses on this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic