*
The moose likes Swing / AWT / SWT and the fly likes How to put the text in The JTable cells? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to put the text in The JTable cells?" Watch "How to put the text in The JTable cells?" New topic
Author

How to put the text in The JTable cells?

selvas kumars
Ranch Hand

Joined: Jan 06, 2001
Posts: 115
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

Joined: Jan 31, 2001
Posts: 2
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

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to put the text in The JTable cells?
 
Similar Threads
JTable
JTable(!!!)
JTable
JTable
JTable