Here you can find the source of getSpinnerFormatter(JSpinner spinner)
public static DefaultFormatter getSpinnerFormatter(JSpinner spinner)
//package com.java2s; //License from project: Open Source License import javax.swing.*; import javax.swing.text.DefaultFormatter; public class Main { public static DefaultFormatter getSpinnerFormatter(JSpinner spinner) { JComponent comp = spinner.getEditor(); JFormattedTextField field = (JFormattedTextField) comp.getComponent(0); return (DefaultFormatter) field.getFormatter(); }//from w w w. j a v a 2 s. c om }