Code example for DefaultFormatterFactory

0
                        "model not a SpinnerPointModel"); 
            } 
            final SpinnerPointModel model = (SpinnerPointModel) spinner.getModel();
 
            JFormattedTextField.AbstractFormatter formatter = PointFormatter.getInstance();
            DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter);
            final JFormattedTextField ftf = getTextField();
            ftf.setEditable(true);
            ftf.setFormatterFactory(factory);
            ftf.setHorizontalAlignment(JTextField.RIGHT);
 
            /* TBD - initializing the column width of the text field 
             * is imprecise and doing it here is tricky because 
             * the developer may configure the formatter later. 
             */ 
            String min = Integer.toString(Integer.MIN_VALUE);
            ftf.setColumns(4 + 2 * min.length());
 
            ftf.addPropertyChangeListener("value", new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent evt) {