Limiting the number of characters that can be entered into a JTextField

I haven’t worked with Swing in a while and I can not remember how to limit the number of characters that a user can enter into a JTextField. I looked at sun’s site and all I could find to accomplish this was the InputVerifier class, but I remember this task being a lot simpler. Maybe something like this:

JTextField jtfCustomerPhone = new JTextField();

Any help will be greatly appreciated.

your answer is here:

Try class NumberFormat!

For example:
NumberFormat N;

public Diagr() {
N = NumberFormat.getInstance();