JFormattedTextField.AbstractFormatterFactory.
DefaultFormatterFactory allows specifying a number of
different JFormattedTextField.AbstractFormatters that are to
be used.
The most important one is the default one
(setDefaultFormatter). The default formatter will be used
if a more specific formatter could not be found. The following process
is used to determine the appropriate formatter to use.
JFormattedTextField have focus? Use the edit
formatter.
AbstractFormatter has not been found, use
the default formatter.
The following code shows how to configure a
JFormattedTextField with two
JFormattedTextField.AbstractFormatters, one for display and
one for editing.
JFormattedTextField.AbstractFormatter editFormatter = ...;
JFormattedTextField.AbstractFormatter displayFormatter = ...;
DefaultFormatterFactory factory = new DefaultFormatterFactory(
displayFormatter, displayFormatter, editFormatter);
JFormattedTextField tf = new JFormattedTextField(factory);
Warning
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeans
has been added to the java.beans package.
Please see java..
javax.swing.JFormattedTextField
| Modifier and Type | Field and Description |
|---|---|
| private JFormattedTextField. | defaultFormat
Default |
| private JFormattedTextField. | displayFormat
|
| private JFormattedTextField. | editFormat
|
| private JFormattedTextField. | nullFormat
|
| Access | Constructor and Description |
|---|---|
| public | |
| public | DefaultFormatterFactory(JFormattedTextField.
JFormattedTextField.AbstractFormatter to be used
if a more specific
JFormattedTextField.AbstractFormatter can not be
found. defaultFormatCreates a |
| public | DefaultFormatterFactory(JFormattedTextField.
JFormattedTextField.AbstractFormatter to be used
if a more specific
JFormattedTextField.AbstractFormatter can not be
found. defaultFormat,JFormattedTextField.AbstractFormatter to be used
when the JFormattedTextField does not have focus. displayFormatCreates a |
| public | DefaultFormatterFactory(JFormattedTextField.
JFormattedTextField.AbstractFormatter to be used
if a more specific
JFormattedTextField.AbstractFormatter can not be
found. defaultFormat,JFormattedTextField.AbstractFormatter to be used
when the JFormattedTextField does not have focus. displayFormat,JFormattedTextField.AbstractFormatter to be used
when the JFormattedTextField has focus. editFormatCreates a DefaultFormatterFactory with the specified JFormattedTextField.AbstractFormatters. |
| public | DefaultFormatterFactory(JFormattedTextField.
JFormattedTextField.AbstractFormatter to be used
if a more specific
JFormattedTextField.AbstractFormatter can not be
found. defaultFormat,JFormattedTextField.AbstractFormatter to be used
when the JFormattedTextField does not have focus. displayFormat,JFormattedTextField.AbstractFormatter to be used
when the JFormattedTextField has focus. editFormat,JFormattedTextField.AbstractFormatter to be used
when the JFormattedTextField has a null value. nullFormatCreates a DefaultFormatterFactory with the specified JFormattedTextField.AbstractFormatters. |
| Modifier and Type | Method and Description |
|---|---|
| public JFormattedTextField. | Returns: JFormattedTextField.AbstractFormatter used if a more specific one is not specified.Returns the |
| public JFormattedTextField. | Returns: JFormattedTextField.AbstractFormatter to use when the JFormattedTextField does not have focusReturns the |
| public JFormattedTextField. | Returns: JFormattedTextField.AbstractFormatter to use when the component has focusReturns the |
| public JFormattedTextField. | Returns: JFormattedTextField.AbstractFormatter to handle formatting duties.JFormattedTextField requesting
JFormattedTextField.AbstractFormatter source)Implements abstract javax. Returns either the default formatter, display formatter, editor formatter or null formatter based on the state of the JFormattedTextField. |
| public JFormattedTextField. | Returns: JFormattedTextField.AbstractFormatter to use when the value is nullReturns the formatter to use if the value is null. |
| public void | setDefaultFormatter(JFormattedTextField.
JFormattedTextField.AbstractFormatter used if a more
specific is not specified atfSets the |
| public void | setDisplayFormatter(JFormattedTextField.
JFormattedTextField.AbstractFormatter to use when the
JFormattedTextField does not have focus atfSets the |
| public void | setEditFormatter(JFormattedTextField.
JFormattedTextField.AbstractFormatter to use when the
component has focus atfSets the |
| public void | setNullFormatter(JFormattedTextField.
JFormattedTextField.AbstractFormatter to use when
the value of the JFormattedTextField is null. atfSets the formatter to use if the value of the JFormattedTextField is null. |
| defaultFormat | back to summary |
|---|---|
| private JFormattedTextField. Default | |
| displayFormat | back to summary |
|---|---|
| private JFormattedTextField.
| |
| editFormat | back to summary |
|---|---|
| private JFormattedTextField.
| |
| nullFormat | back to summary |
|---|---|
| private JFormattedTextField.
| |
| DefaultFormatterFactory | back to summary |
|---|---|
| public DefaultFormatterFactory() Constructs a | |
| DefaultFormatterFactory | back to summary |
|---|---|
| public DefaultFormatterFactory(JFormattedTextField. Creates a
| |
| DefaultFormatterFactory | back to summary |
|---|---|
| public DefaultFormatterFactory(JFormattedTextField. Creates a
| |
| DefaultFormatterFactory | back to summary |
|---|---|
| public DefaultFormatterFactory(JFormattedTextField. Creates a DefaultFormatterFactory with the specified JFormattedTextField.AbstractFormatters.
| |
| DefaultFormatterFactory | back to summary |
|---|---|
| public DefaultFormatterFactory(JFormattedTextField. Creates a DefaultFormatterFactory with the specified JFormattedTextField.AbstractFormatters.
| |
| getDefaultFormatter | back to summary |
|---|---|
| public JFormattedTextField. Returns the
| |
| getDisplayFormatter | back to summary |
|---|---|
| public JFormattedTextField. Returns the
| |
| getEditFormatter | back to summary |
|---|---|
| public JFormattedTextField. Returns the
| |
| getFormatter | back to summary |
|---|---|
| public JFormattedTextField. Implements abstract javax. Returns either the default formatter, display formatter, editor formatter or null formatter based on the state of the JFormattedTextField.
| |
| getNullFormatter | back to summary |
|---|---|
| public JFormattedTextField. Returns the formatter to use if the value is null.
| |
| setDefaultFormatter | back to summary |
|---|---|
| public void setDefaultFormatter(JFormattedTextField. Sets the
| |
| setDisplayFormatter | back to summary |
|---|---|
| public void setDisplayFormatter(JFormattedTextField. Sets the
| |
| setEditFormatter | back to summary |
|---|---|
| public void setEditFormatter(JFormattedTextField. Sets the
| |
| setNullFormatter | back to summary |
|---|---|
| public void setNullFormatter(JFormattedTextField. Sets the formatter to use if the value of the JFormattedTextField is null.
| |