public abstract static class JFormattedTextField.AbstractFormatter extends java.lang.Object implements java.io.Serializable
| Constructor and Description |
|---|
JFormattedTextField.AbstractFormatter() |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Object |
clone()
Clones the AbstractFormatter and removes the association to any
particular JFormattedTextField.
|
protected Action[] |
getActions()
Returns a custom set of Actions that this formatter supports.
|
protected javax.swing.text.DocumentFilter |
getDocumentFilter()
Gets the DocumentFilter for this formatter.
|
protected JFormattedTextField |
getFormattedTextField()
Returns the JFormattedTextField on which this formatter is
currently installed.
|
protected javax.swing.text.NavigationFilter |
getNavigationFilter()
Gets the NavigationFilter for this formatter.
|
void |
install(JFormattedTextField textField)
Installs this formatter on the specified JFormattedTextField.
|
protected void |
invalidEdit()
Invoke this method when invalid values are entered.
|
protected void |
setEditValid(boolean valid)
This method updates the
editValid property of
JFormattedTextField. |
abstract java.lang.Object |
stringToValue(java.lang.String text)
Parses
text to return a corresponding Object. |
void |
uninstall()
Clears the state installed on the JFormattedTextField by the formatter.
|
abstract java.lang.String |
valueToString(java.lang.Object value)
Returns a String to be displayed, based on the Object
value. |
public JFormattedTextField.AbstractFormatter()
protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedException - if the Object's class doesn't support
the Cloneable interfaceCloneableprotected Action[] getActions()
null. Should be subclassed by formatters that want
to install custom Actions on the JFormattedTextField.protected javax.swing.text.DocumentFilter getDocumentFilter()
null. Should be subclassed by formatters
that want to restrict Document mutations.protected JFormattedTextField getFormattedTextField()
protected javax.swing.text.NavigationFilter getNavigationFilter()
DefaultFormatter) that wish to
restrict where the cursor can be placed within the text field.null. Subclassed by formatters that want to restrict
cursor location within the JFormattedTextField.public void install(JFormattedTextField textField)
getActions.
It also installs a DocumentFilter and NavigationFilter on the
JFormattedTextField.
If there is a ParseException this sets the text to an
empty String and marks the text field in an invalid state.
textField - the JFormattedTextField on which to install this
formatterpublic void uninstall()
getActions()).protected void invalidEdit()
protected void setEditValid(boolean valid)
editValid property of
JFormattedTextField.valid - the new state for the editValid propertypublic abstract java.lang.Object stringToValue(java.lang.String text) throws java.text.ParseException
text to return a corresponding Object.text - the String to parsetext representedjava.text.ParseException - if there is an error in the conversionpublic abstract java.lang.String valueToString(java.lang.Object value) throws java.text.ParseException
value.value - the Object from which to generate a Stringjava.text.ParseException - if there is an error in the conversion