How would I go about making JTextField allow the user to input only numbers 0 - 9? I looked into JFormattedTextField but it doesnt seem to be what I need. Would I have to code it to check the users' input everytime? Is there a simpler way?

Recommended Answers

All 2 Replies

formatted text field supplys all you need to do this ?

it will defnatel do what you want it to.

if you have a go and post code then we can show you what your doing wrong.

Got it..,
I used the MaskFormatter class to make it do what I wanted.
thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.