javax.swing
Class JSpinner.ListEditor.ListFormatter
java.lang.Object
javax.swing.JFormattedTextField.AbstractFormatter
javax.swing.JSpinner.ListEditor.ListFormatter
- All Implemented Interfaces:
- Serializable
- Enclosing class:
- JSpinner.ListEditor
- private class JSpinner.ListEditor.ListFormatter
- extends JFormattedTextField.AbstractFormatter
ListFormatter provides completion while text is being input
into the JFormattedTextField. Completion is only done if the
user is inserting text at the end of the document. Completion
is done by way of the SpinnerListModel method findNextMatch.
filter
private DocumentFilter filter
JSpinner.ListEditor.ListFormatter
private JSpinner.ListEditor.ListFormatter()
valueToString
public String valueToString(Object value)
throws ParseException
- Description copied from class:
JFormattedTextField.AbstractFormatter
- Returns the string value to display for
value
.
- Specified by:
valueToString
in class JFormattedTextField.AbstractFormatter
- Parameters:
value
- Value to convert
- Returns:
- String representation of value
- Throws:
ParseException
- if there is an error in the conversion
stringToValue
public Object stringToValue(String string)
throws ParseException
- Description copied from class:
JFormattedTextField.AbstractFormatter
- Parses
text
returning an arbitrary Object. Some
formatters may return null.
- Specified by:
stringToValue
in class JFormattedTextField.AbstractFormatter
- Parameters:
string
- String to convert
- Returns:
- Object representation of text
- Throws:
ParseException
- if there is an error in the conversion
getDocumentFilter
protected DocumentFilter getDocumentFilter()
- Description copied from class:
JFormattedTextField.AbstractFormatter
- Subclass and override if you wish to provide a
DocumentFilter
to restrict what can be input.
install
will install the returned value onto
the JFormattedTextField
.
- Overrides:
getDocumentFilter
in class JFormattedTextField.AbstractFormatter
- Returns:
- DocumentFilter to restrict edits