• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable: value of a cell when editing stoped  RSS feed

 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a JTable, and CellListener for this table. In that listener I use method editingStopped() to listen when cell had been edited. I want to also implements a way to get the value that was just entered in the cell, is there anyway to do it? Here is what I have so far:
public void addMainTableCellListener(final JTable jt){
final DefaultCellEditor dce=(DefaultCellEditor)jt.getCellEditor(0,0);
dce.addCellEditorListener(new CellEditorListener(){
public void editingStopped(ChangeEvent e){
addMouseListener(jt);
setTotalMainTable();
}
public void editingCanceled(ChangeEvent e){}
});
}
thanks,
Alex
 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anybody?
 
keerthi matta
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
In the editingStopped() method, just make a call DefaultCellEditor as
dce.getCellEditorValue() which will return us the value of that particular cell which is modified
hope this solves ur requirement
keerthi
njoy coding
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!