This is an academic exercise. Does anyone know if a JFormattedTextField can dynamically alter its field with extra characters as one types in the data? For example, let's say I want to type in a US Phone number. Starting with a blank field, after typing three digits, xyz, I want those digits to be replaced with (xyz) followed by a space. The next three digits should be automatically followed by a hyphen and then I type in the last four digits. So the () and the hyphen are inserted as appropriate (and not before). Also as I backspace, those characters should go away when the digits that caused them to appear are deleted.

I figure I could do this by providing my own plaintext document model to the text field but I was wondering if this capability exists with the JFormattedTextField and the existing formatter classes? I have not found anything in the API or tutorials.