javax.swing.undo


1. Undo and Redo Actions in Text Editor

import javax.swing.text.Document;
import javax.swing.undo.UndoManager;

class TextEditor {
    private UndoManager undoManager = new UndoManager();
    private Document document;

    public void undo() {
        if (undoManager.canUndo()) {
            undoManager.undo();
        }
    }

    public void redo() {
        if (undoManager.canRedo()) {
            undoManager.redo();
        }
    }

    public void addUndoableEdit(UndoableEdit edit) {
        undoManager.addEdit(edit);
    }

    // ...
}

2. Undo and Redo in Drawing Application

3. Undo and Redo in Image Editor

4. Undo and Redo in Spreadsheet

5. Undo and Redo in Tree

6. Undo and Redo in List

7. Undo and Redo in Table

8. Undo and Redo in Text Area

9. Undo and Redo in Calendar

10. Undo and Redo in File Picker

11. Undo and Redo in Color Picker

12. Undo and Redo in Font Picker

13. Undo and Redo in Dialog

14. Undo and Redo in Menu

15. Undo and Redo in Toolbar

16. Undo and Redo in Panel

17. Undo and Redo in Split Pane

18. Undo and Redo in Tabbed Pane

19. Undo and Redo in Tree Table

20. Undo and Redo in Editor Pane

21. Undo and Redo in File Chooser

22. Undo and Redo in JComboBox

23. Undo and Redo in JFormattedTextField

24. Undo and Redo in JList

25. Undo and Redo in JMenuItem

26. Undo and Redo in JPasswordField

27. Undo and Redo in JProgressBar

28. Undo and Redo in JScrollPane

29. Undo and Redo in JSlider

30. Undo and Redo in JTabbedPane

31. Undo and Redo in JTable

32. Undo and Redo in JTextPane

33. Undo and Redo in JToggleButton

34. Undo and Redo in JToolBar

35. Undo and Redo in JTree

36. Undo and Redo in JViewport

37. Undo and Redo in List Model

38. Undo and Redo in Spinner Model

39. Undo and Redo in Table Model

40. Undo and Redo in Tree Model

41. Undo and Redo in DefaultMutableTreeNode

42. Undo and Redo in DefaultTreeModel

43. Undo and Redo in UndoableEdit

44. Undo and Redo in CompoundEdit

45. Undo and Redo in AbstractUndoableEdit

46. Undo and Redo in UndoableEditSupport

47. Undo and Redo in UndoableChangeSupport

48. Undo and Redo in UndoEvent

49. Undo and Redo in UndoableEditListener

50. Undo and Redo in UndoManager