List of usage examples for javax.swing.text DateFormatter DateFormatter
public DateFormatter()
new DateFormatter(DateFormat.getDateInstance())
. From source file:org.springframework.richclient.form.FormatterFactory.java
public AbstractFormatter getFormatter(JFormattedTextField source) { Object value = source.getValue(); DefaultFormatter formatter;/*from www. j a v a 2s . com*/ if (value instanceof Date) { formatter = new DateFormatter(); } else if (value instanceof Number) { formatter = new NumberFormatter(); } else { formatter = new DefaultFormatter(); } if (logger.isDebugEnabled()) { logger.debug("Factory returning new formatter " + formatter + " for text field " + source); } valueCommitPolicy.configure(source, formatter); if (valueClass != null) { formatter.setValueClass(valueClass); } else if (value != null) { formatter.setValueClass(value.getClass()); } return formatter; }