Modify your application menu to include an Edit menu. In the
edit menu create an Undo and a Redo menu item. These should
also be mapped to control-z and control-y respectively. This
should undo and/or redo any changes that have happened. The
granularity of the undo/redo operations is between mouseDown() and
mouseUp() or on a single key() event. It should be more than every
mouseMove().
This should work for all of your various widgets that you have
built so far. If you have done everything correctly, only the
model objects need to be tracked for undo/redo because all of the
drawing objects are either static or are connected to model objects.