Here you can find the source of createIntegerFormatter(int minimum, int maximum)
public static NumberFormatter createIntegerFormatter(int minimum, int maximum)
//package com.java2s; //License from project: LGPL import java.text.NumberFormat; import javax.swing.text.NumberFormatter; public class Main { public static NumberFormatter createIntegerFormatter(int minimum, int maximum) { NumberFormat format = NumberFormat.getIntegerInstance(); NumberFormatter formatter = new NumberFormatter(format); formatter.setMinimum(minimum);/* w w w . j av a 2 s . com*/ formatter.setMaximum(maximum); formatter.setValueClass(Integer.class); formatter.setCommitsOnValidEdit(true); return formatter; } }