| Summary: | Users make mistakes, and as developers it's important that we help them recover gracefully from mistakes by including support for undo in our user interfaces. The new undo/redo mechanism available in Swing allows us to do just that. This article describes how to add undo/redo capabilities to Java applications. It explains the design of an undo/redo mechanism by introducing the Command pattern and Swing's support for the pattern. In addition, the author provides an overview of Swing's undo mechanism and a sample applet that demonstrates the concept. (3,000 words)
|