public void removeText(){
  if (0 < texts.size()) {
    texts.remove(texts.size() - 1);
    invalidate();
  }
}

public void removeText ( ) { if ( 0 < texts . size ( ) ) { texts . remove ( texts . size ( ) - 1 ) ; invalidate ( ) ; } }
removes the text on the top of the stack .
