コード例 #1
0
  /**
   * Creates a copy of the DefaultFormatter.
   *
   * @return copy of the DefaultFormatter
   */
  public Object clone() throws CloneNotSupportedException {
    InternationalFormatter formatter = (InternationalFormatter) super.clone();

    formatter.literalMask = null;
    formatter.iterator = null;
    formatter.validMask = false;
    formatter.string = null;
    return formatter;
  }
コード例 #2
0
 /**
  * Resets the region to delete to be the complete document and the text from invoking
  * valueToString on the current value.
  */
 void resetFromValue(InternationalFormatter formatter) {
   // Need to reset the complete string as Format's result can
   // be completely different.
   offset = 0;
   try {
     text = formatter.valueToString(value);
   } catch (ParseException pe) {
     // Should never happen, otherwise canReplace would have
     // returned value.
     text = "";
   }
   length = fb.getDocument().getLength();
 }