Allow only numerical input on JTextField

I am using netbeans to create a GUI with swing/matisse. I am trying to create a Phone Number and zip code FormattedJtextFields. How do I make it so only numbers can be entered? I have been reading tutorials about mask formatter but I am creating the JTextFields with GUI tools, not from scratch so how can I use these features?

I am using netbeans to create a GUI with swing/matisse. I am trying to create a Phone Number and zip code FormattedJtextFields. How do I make it so only numbers can be entered? I have been reading tutorials about mask formatter but I am creating the JTextFields with GUI tools, not from scratch so how can I use these features?

If using NetBeans, it can create the Formatter for your JFormattedTextField for you. Simply create the JFormattedTextField, then scroll through its properties til you get to formatterFactory, and click on the button with the ellipsis "..." on it. Then follow the instructions, and you're golden.