JFormattedTextField.AbstractFormatter (Java Platform SE 8 ) (original) (raw)


public abstract static class JFormattedTextField.AbstractFormatter
extends Object
implements Serializable
Instances of AbstractFormatter are used byJFormattedTextField to handle the conversion both from an Object to a String, and back from a String to an Object.AbstractFormatters can also enforce editing policies, or navigation policies, or manipulate theJFormattedTextField in any way it sees fit to enforce the desired policy.
An AbstractFormatter can only be active in one JFormattedTextField at a time.JFormattedTextField invokesinstall when it is ready to use it followed by uninstall when done. Subclasses that wish to install additional state should overrideinstall and message super appropriately.
Subclasses must override the conversion methodsstringToValue and valueToString. Optionally they can override getActions,getNavigationFilter and getDocumentFilter to restrict the JFormattedTextField in a particular way.
Subclasses that allow the JFormattedTextField to be in a temporarily invalid state should invoke setEditValid at the appropriate times.
Since:
1.4

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.