public class DatePickerFormatter extends JFormattedTextField.AbstractFormatter
Modifier and Type | Class and Description |
---|---|
static class |
DatePickerFormatter.DatePickerFormatterUIResource
Same as DatePickerFormatter, but tagged as UIResource.
|
Modifier and Type | Field and Description |
---|---|
private DateFormat[] |
_formats |
private static Logger |
LOG |
Constructor and Description |
---|
DatePickerFormatter()
Instantiates a formatter with the localized format patterns defined
in the swingx.properties.
|
DatePickerFormatter(DateFormat[] formats)
Instantiates a formatter with the given date formats.
|
DatePickerFormatter(DateFormat[] formats,
Locale locale)
Instantiates a formatter with the given formats and locale.
|
DatePickerFormatter(Locale locale)
Instantiates a formatter with default date formats in the
given locale.
|
Modifier and Type | Method and Description |
---|---|
private void |
addFormat(List<DateFormat> f,
String key,
Locale locale)
Creates and adds a DateFormat to the given list.
|
private void |
addSystemDefaultFormat(List<DateFormat> f,
Locale locale)
Adds the system's default DateFormat.
|
protected DateFormat[] |
createDefaultFormats(Locale locale)
Creates and returns the localized default formats.
|
DateFormat[] |
getFormats()
Returns an array of the formats used by this formatter.
|
Object |
stringToValue(String text) |
String |
valueToString(Object value) |
clone, getActions, getDocumentFilter, getFormattedTextField, getNavigationFilter, install, invalidEdit, setEditValid, uninstall
private DateFormat[] _formats
public DatePickerFormatter()
public DatePickerFormatter(DateFormat[] formats)
formats
- the array of formats to use. May be null to
use defaults or empty to do nothing (?), but must not contain
null formats.public DatePickerFormatter(Locale locale)
locale
- the Locale the use for the default formats.public DatePickerFormatter(DateFormat[] formats, Locale locale)
formats
- locale
- public DateFormat[] getFormats()
public Object stringToValue(String text) throws ParseException
stringToValue
in class JFormattedTextField.AbstractFormatter
ParseException
public String valueToString(Object value) throws ParseException
valueToString
in class JFormattedTextField.AbstractFormatter
ParseException
protected DateFormat[] createDefaultFormats(Locale locale)
private void addSystemDefaultFormat(List<DateFormat> f, Locale locale)
f
- the List of formats to add tolocale
- the Locale to use for the formatter.private void addFormat(List<DateFormat> f, String key, Locale locale)
f
- the list of formatskey
- the key for getting the pattern from the UIWebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses