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.
AbstractFormatter
s can also enfore 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.