Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
javax.swing.JFormattedTextField.AbstractFormatterFactory
javax.swing.text.DefaultFormatterFactory
public class DefaultFormatterFactory
implements Serializable
Constructor Summary | |
| |
| |
| |
| |
|
Method Summary | |
JFormattedTextField.AbstractFormatter |
|
JFormattedTextField.AbstractFormatter |
|
JFormattedTextField.AbstractFormatter |
|
JFormattedTextField.AbstractFormatter |
|
JFormattedTextField.AbstractFormatter |
|
void |
|
void |
|
void |
|
void |
|
Methods inherited from class javax.swing.JFormattedTextField.AbstractFormatterFactory | |
getFormatter |
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public DefaultFormatterFactory()
Creates a DefaultFormatterFactory with no formatters
public DefaultFormatterFactory(JFormattedTextField.AbstractFormatter defaultFormat)
Creates a new DefaultFormatterFactory with the specified formatters.
- Parameters:
defaultFormat
- the formatter to use if no other appropriate non-null formatted can be found.
public DefaultFormatterFactory(JFormattedTextField.AbstractFormatter defaultFormat, JFormattedTextField.AbstractFormatter displayFormat)
Creates a new DefaultFormatterFactory with the specified formatters.
- Parameters:
defaultFormat
- the formatter to use if no other appropriate non-null formatted can be found.displayFormat
- the formatter to use if the JFormattedTextField doesn't have focus and either the value is not null or the value is null but nonullFormatter
has been specified.
public DefaultFormatterFactory(JFormattedTextField.AbstractFormatter defaultFormat, JFormattedTextField.AbstractFormatter displayFormat, JFormattedTextField.AbstractFormatter editFormat)
Creates a new DefaultFormatterFactory with the specified formatters.
- Parameters:
defaultFormat
- the formatter to use if no other appropriate non-null formatted can be found.displayFormat
- the formatter to use if the JFormattedTextField doesn't have focus and either the value is not null or the value is null but nonullFormatter
has been specified.editFormat
- the formatter to use if the JFormattedTextField has focus and either the value is not null or the value is null but notnullFormatter
has been specified.
public DefaultFormatterFactory(JFormattedTextField.AbstractFormatter defaultFormat, JFormattedTextField.AbstractFormatter displayFormat, JFormattedTextField.AbstractFormatter editFormat, JFormattedTextField.AbstractFormatter nullFormat)
Creates a new DefaultFormatterFactory with the specified formatters.
- Parameters:
defaultFormat
- the formatter to use if no other appropriate non-null formatted can be found.displayFormat
- the formatter to use if the JFormattedTextField doesn't have focus and either the value is not null or the value is null but nonullFormatter
has been specified.editFormat
- the formatter to use if the JFormattedTextField has focus and either the value is not null or the value is null but notnullFormatter
has been specified.nullFormat
- the formatter to use when the value of the JFormattedTextField is null.
public JFormattedTextField.AbstractFormatter getDefaultFormatter()
Returns the formatted to be used if no other appropriate non-null formatter can be found.
- Returns:
- the formatted to be used if no other appropriate non-null formatter can be found.
public JFormattedTextField.AbstractFormatter getDisplayFormatter()
Gets thedisplayFormatter
. This is the formatter to use if the JFormattedTextField is not being edited and either the value is not null or the value is null and nonullFormatter
has been specified.
- Returns:
- the formatter to use if the JFormattedTextField is not being edited and either the value is not null or the value is null and no
nullFormatter
has been specified.
public JFormattedTextField.AbstractFormatter getEditFormatter()
Gets theeditFormatter
. This is the formatter to use if the JFormattedTextField is being edited and either the value is not null or the value is null and nonullFormatter
has been specified.
- Returns:
- the formatter to use if the JFormattedTextField is being edited and the value is not null or the value is null but no nullFormatted has been specified.
public JFormattedTextField.AbstractFormatter getFormatter(JFormattedTextField tf)
Returns the appropriate formatter based on the state oftf
. Iftf
is null we return null, otherwise we return one of the following: 1. Returns
nullFormatter
iftf.getValue()
is null andnullFormatter
is not. 2. ReturnseditFormatter
iftf.hasFocus()
is true andeditFormatter
is not null. 3. ReturnsdisplayFormatter
iftf.hasFocus()
is false anddisplayFormatter
is not null. 4. Otherwise returnsdefaultFormatter
.
- Overrides:
- getFormatter in interface JFormattedTextField.AbstractFormatterFactory
public JFormattedTextField.AbstractFormatter getNullFormatter()
Gets the formatter to use if the value of the JFormattedTextField is null.
- Returns:
- the formatter to use for null values.
public void setDefaultFormatter(JFormattedTextField.AbstractFormatter defaultFormatter)
Sets the formatted to be used if no other appropriate non-null formatter can be found.
- Parameters:
defaultFormatter
- the formatted to be used if no other appropriate non-null formatter can be found.
public void setDisplayFormatter(JFormattedTextField.AbstractFormatter displayFormatter)
Sets thedisplayFormatter
. This is the formatter to use if the JFormattedTextField is not being edited and either the value is not null or the value is null and nonullFormatter
has been specified.
- Parameters:
displayFormatter
- the formatter to use.
public void setEditFormatter(JFormattedTextField.AbstractFormatter editFormatter)
Sets theeditFormatter
. This is the formatter to use if the JFormattedTextField is being edited and either the value is not null or the value is null and nonullFormatter
has been specified.
- Parameters:
editFormatter
- the formatter to use.
public void setNullFormatter(JFormattedTextField.AbstractFormatter nullFormatter)
Sets thenullFormatter
. This is the formatter to use if the value of the JFormattedTextField is null.
- Parameters:
nullFormatter
- the formatter to use for null values.