code: public synchronized TextBox setValidationPattern(Pattern validationPattern) {
          if(validationPattern != null) {
              for(String line: lines) {
                  if(!validated(line)) {
                      throw new IllegalStateException("TextBox validation pattern " + validationPattern + " does not match existing content");
                  }
              }
          }
          this.validationPattern = validationPattern;
          return this;
      }
docs: Sets a pattern on which the content of the text box is to be validated. For multi-line TextBox:s, the pattern is
  checked against each line individually, not the content as a whole. Partial matchings will not be allowed, the
  whole pattern must match, however, empty lines will always be allowed. When the user tried to modify the content
  of the TextBox in a way that does not match the pattern, the operation will be silently ignored. If you set this
  pattern to {@code null}, all validation is turned off.
  @param validationPattern Pattern to validate the lines in this TextBox against, or {@code null} to disable
  @return itself