Can i add an UndoableEditListener to a JTable? For example with a JTextField we do this :
textField = new JTextField();
Document doc = textField.getDocument();
doc.addUndoableEditListener(new MyUndoableEditListener());
No one stop use to assign this listener to the Document
of of Text Field cell editor of JTable
:) For your table use a custom cell editor, implement the UndoableEditListener
to the editor's text component's Document.
Check out the Official Tutorial page for example and demo using CellEditor
You can do that for
CellEditor
of theJTabel
in next way:use
DefaultCellEditor
withJTextField
:table
is yourJTable
andCOLUMN_INDEX
index of needed column.