List of usage examples for javax.swing.text NumberFormatter NumberFormatter
public NumberFormatter()
NumberFormatter
with the a default NumberFormat
instance obtained from NumberFormat.getNumberInstance()
. From source file:org.springframework.richclient.form.FormatterFactory.java
public AbstractFormatter getFormatter(JFormattedTextField source) { Object value = source.getValue(); DefaultFormatter formatter;/*from w ww .j a v a 2 s .c o m*/ 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; }