Code example for DefaultFormatterFactory

0
 
    public IntegerParameter() { 
        NumberFormat format = NumberFormat.getIntegerInstance();
        format.setGroupingUsed(false);
        NumberFormatter formatter = new NumberFormatter(format);
        DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter);
        setFormatterFactory(factory);
        setHorizontalAlignment(JFormattedTextField.RIGHT);
        setParameter(Long.valueOf(0));
    } 
 
    @Override 
    public void setParameter(@Nullable Object parameter) { 
        if (parameter != null) { 
            if (parameter instanceof Long) {
                setValue(parameter);
            } else { 
                setValue(Long.valueOf((String) parameter));
            } 
        } else { 
Contextual code suggestions in your IDE  Get Codota for Java