This content has been marked as final. Show 2 replies
Look at the package javax.swing.undo package - UndoableEdit interface and UndoManager class.
Just implement the interface. Store all necessary data to perform your action (colors, pixels, shapes etc.). Add all your UndoableEdits in an UndoManager instance and call undo() redo() when you need.
Thanks, although having looked at the API, I think it's more convenient for me to extend UndoManager than to implement UndoableEdit.