Mega Code Archive
Creating a Text Field to Display and Edit a Phone Number
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);
}
}