How can I define custom EditMasks, like xxx-xxx-xxx or xxx.xxx.xxx.xxx, for a JTextField?

Anjum Khan

There is a Java Developers Journal article that describes in detail the best way to do this (with code examples). See http://www.sys-con.com/java/feature/4-1/jmaskfield

It is very good example with explanations using MVC concepts of all your needs for defining custom edit masks, including date formats, String/numeric formats etc.