コード例 #1
0
 /** Overriden to unconditionally allow the replace if ignoreDocumentMutate is true. */
 void replace(
     DocumentFilter.FilterBypass fb, int offset, int length, String text, AttributeSet attrs)
     throws BadLocationException {
   if (ignoreDocumentMutate) {
     fb.replace(offset, length, text, attrs);
     return;
   }
   super.replace(fb, offset, length, text, attrs);
 }
コード例 #2
0
 /** Overriden to update the mask after invoking supers implementation. */
 void updateValue(Object value) {
   super.updateValue(value);
   updateMaskIfNecessary();
 }
コード例 #3
0
 /**
  * Installs the <code>DefaultFormatter</code> onto a particular <code>JFormattedTextField</code>.
  * This will invoke <code>valueToString</code> to convert the current value from the <code>
  * JFormattedTextField</code> to a String. This will then install the <code>Action</code>s from
  * <code>getActions</code>, the <code>DocumentFilter</code> returned from <code>getDocumentFilter
  * </code> and the <code>NavigationFilter</code> returned from <code>getNavigationFilter</code>
  * onto the <code>JFormattedTextField</code>.
  *
  * <p>Subclasses will typically only need to override this if they wish to install additional
  * listeners on the <code>JFormattedTextField</code>.
  *
  * <p>If there is a <code>ParseException</code> in converting the current value to a String, this
  * will set the text to an empty String, and mark the <code>JFormattedTextField</code> as being in
  * an invalid state.
  *
  * <p>While this is a public method, this is typically only useful for subclassers of <code>
  * JFormattedTextField</code>. <code>JFormattedTextField</code> will invoke this method at the
  * appropriate times when the value changes, or its internal state changes.
  *
  * @param ftf JFormattedTextField to format for, may be null indicating uninstall from current
  *     JFormattedTextField.
  */
 public void install(JFormattedTextField ftf) {
   super.install(ftf);
   updateMaskIfNecessary();
   // invoked again as the mask should now be valid.
   positionCursorAtInitialLocation();
 }