I\'m writing a painting/graphics Java application for a mobile phone (so memory is limited). The application state is essentially three 1000x500 bitmaps (i.e. layers of a pa
About your Use the command pattern point: Starting from the initial state and again executing Commands are not needed at all. Each Command class should represent a small user action and should have mechanism to undo what it does in its execute() method, if undo operation is to be supported. We maintain a stack of ***Command objects. When user undoes something, a Command object is popped out from the stack and its undo() method gets called.
I do not see any motivation for using memento pattern in your case as the undo actions will be in FIFO order. User is not allowed to undo actions as he pleases, I guess.