protected synchronized void undo(){
  if (currentState != null) {
    while (redoStack.size() >= stackSize) {
      redoStack.removeElementAt(0);
      logger.info("making room for " + currentState.getDescription());
    }
    redoStack.push(currentState);
    if (logger.isLoggable(Level.FINE)) {
      logger.fine("making last current state (" + currentState.getDescription() + ") on redo stack");
    }
  }
  currentState=undoStack.pop();
  if (logger.isLoggable(Level.FINE)) {
    logger.fine("making top undo state (" + currentState.getDescription() + ") current state");
  }
  if (currentState != null) {
    if (logger.isLoggable(Level.FINE)) {
      logger.fine("calling setState on " + currentState.getDescription());
    }
    currentState.setState();
  }
  fireStackStatus();
}

protected synchronized void undo ( ) { if ( currentState != null ) { while ( redoStack . size ( ) >= stackSize ) { redoStack . removeElementAt ( 0 ) ; logger . info ( "making room for " + currentState . getDescription ( ) ) ; } redoStack . push ( currentState ) ; if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "making last current state (" + currentState . getDescription ( ) + ") on redo stack" ) ; } } currentState = undoStack . pop ( ) ; if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "making top undo state (" + currentState . getDescription ( ) + ") current state" ) ; } if ( currentState != null ) { if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "calling setState on " + currentState . getDescription ( ) ) ; } currentState . setState ( ) ; } fireStackStatus ( ) ; }
take a undoevent off the backstack , and push it on the forward stack , and invoke the new currentstate so the source component gets modified .
