Module java.desktop
Package javax.swing

Class JFormattedTextField.AbstractFormatter

java.lang.Object
javax.swing.JFormattedTextField.AbstractFormatter
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
DefaultFormatter
Enclosing class:
JFormattedTextField

public abstract static class JFormattedTextField.AbstractFormatter extends Object implements Serializable
Instances of AbstractFormatter are used by JFormattedTextField 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 the JFormattedTextField in any way it sees fit to enforce the desired policy.

An AbstractFormatter can only be active in one JFormattedTextField at a time. JFormattedTextField invokes install when it is ready to use it followed by uninstall when done. Subclasses that wish to install additional state should override install and message super appropriately.

Subclasses must override the conversion methods stringToValue 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