How to limit the textfield ?
Hi, I need a help. I should limit the number of typed letters. When that number pass over a value, the component (textfield) should not accept more typed letters. Example, suppose that the component just accept 5 letters. When the user type "ABCDEF", the component will just accept "ABCDE" and the letter "F" will not displayed.
Help me !!! thanks
Sizino Junior
[380 byte] By [
SizinoJra] at [2007-10-3 3:43:59]

Read the JTextField API. From there you will find a like "How to Use Text Fields" which will take you to the Swing tutorial on using text components. If you read the tutorial you will find out how to use:
a) a JFormattedTextField
b) a DocumentFilter
to achieve your desired goal.
Ok, I read. But i don't want use a MaskFormatter. I磀 like use something same DocumentFilter, but this doesn't work with TextField, just TextArea.Please, help me !!!!