code: public void setTextFieldToValidStateIfNeeded() {
          // Find out if the text field needs to be set to the last valid time or not.
          // The text field needs to be set whenever its text does not match the standard format
          // for the last valid time.
          String standardTimeString = zGetStandardTextFieldTimeString(lastValidTime);
          String textFieldString = timeTextField.getText();
          if (!standardTimeString.equals(textFieldString)) {
              // Overwrite the text field with the last valid time.
              // This will clear the text field if the last valid time is null.
              setTime(lastValidTime);
          }
      }
docs: setTextFieldToValidStateIfNeeded,
  
  This function will check the contents of the text field, and when needed, will set the text
  to match the "last valid time" in a standardized valid format. This function is automatically
  called whenever the time picker text field loses focus, or at other times when the text must
  be set to a valid state. It is not expected that the programmer will normally need to call
  this function directly.
  
  This function has two possible effects: 1) If the current text is already valid and is in the
  standard format, then this will do nothing. If the text is not valid, or if the text is not
  in the standard format, then: 2) This will replace the invalid text in the text field with a
  standard time field text string that matches the last valid time.