Well, Andrew's answer is the best answer. Making a PlainDocument that accepts only numbers and only up to a certain number of numbers, then PlainDocuments and extending JTextField is the way to go.
Andrew posted a good tutorial, and if I was at my desk at work and not onsite at one of our regions, I'd post the simple code that you need. But I guess it is better this way because you can learn to use PlainDocuments on your own.
Mark