Typical undo/redo parts

In the Java language undo/redo support is made availabe to all text components through a common set of parts, which can be used almost simliarly between different applications dealing with text processing.

UndoManager

An UndoManager 'remembers' undoable edit acionst. It is the central place to store such edit actions for later use in a possible undo/redo action.

UndoableEditListener

For being able to store undoable edit actions a class has to implement the UndoableEditListener interface. By implementing this interface, an object can register itself with any Document whose undoable edit events it likes to handle.

By listening to undoable edit events, a class acting as an UndoableEditListener can as well update GUI elements according to the undoable edit events received.

Undo and redo actions

To actually undo or redo an undoable edit, actions are used as a common way to make an undo or redo command available on the GUI. These actions call UndoManager methods to undo or redo an undoable edit. As well the actions can be used to adapt the GUI according to the current undo/redo state.