how do u set your jTextField so that it does not keep accepting input e.g for a name JTextField.how ca u also make it accept tex only and reject numerals
Joined: Apr 11, 2005
I'm not quite sure what you meant with your first question, but to make it read-only, use .isEditable(false) on your JTextField.
If you wanted to fix the size of the field, look at the constructors in the API, just add a number to the end, eg JTextField("",10); I think thats how it works
I'm not sure about getting it to just accept letters, Perhaps if you have a submit button, you could get this to allow/disallow certain input in the JTextField. [ May 12, 2006: Message edited by: colin shuker ]
I have added a KeyListener to my JTextField and told the key listener to not accept anything that's a number. If they type a number, it beeps and deletes the number.
Joined: Sep 16, 2005
Originally posted by Alice B Palmer: I have added a KeyListener to my JTextField and told the key listener to not accept anything that's a number. If they type a number, it beeps and deletes the number.
Does this work if you copy or cut some text (^C or ^X) and then paste (^V) it into your text field?