Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to put the text in The JTable cells?

 
selvas kumars
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here i am able to edit the text in JTable and able to change the text,but when the cell lost focus the old text is placed and the new entry goes away.I am using abstract table model..can any body can help me in solving it??
thanks,
selvas
 
Steve Zeller
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe you'll need to use the stopCellEditing method on the TableCellEditor interface. Something like this in your FocusEvent method:
TableCellEditor editor = table.getCellEditor();
if (editor != null)
editor.stopCellEditing();
From the API:
stopCellEditing
public boolean stopCellEditing()
Tell the editor to stop editing and accept any partially edited value as the value of the editor. The editor returns false if editing was not stopped, useful for editors which validates and can not accept invalid entries.
Returns:
true if editing was stopped

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic