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());
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());
Sage
On
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
Copyright © 2021 Jogjafile Inc.
You can do that for
CellEditorof theJTabelin next way:use
DefaultCellEditorwithJTextField:tableis yourJTableandCOLUMN_INDEXindex of needed column.