Java tutorial
import javax.swing.JFormattedTextField; import javax.swing.text.MaskFormatter; public class Main { public static void main(String[] argv) throws Exception { MaskFormatter fmt = new MaskFormatter("###-###-####"); JFormattedTextField tft1 = new JFormattedTextField(fmt); } }