Click to See Complete Forum and Search --> : setting maximum length for TextField


nirmit
May 4th, 2000, 10:47 AM
I want to have the length of the input value in the textfield to be limited. But the displayed length of textfield may be more.

This feature is available in html forms wherein you can easily specify Maxlength and minLength also.

I want the same with applets. i tried setbounds() method but it is to resize and move the field.

Thanks for your help.

May 5th, 2000, 01:17 AM
HI,
As far as I know, there is no method to set the length property in the TextField. This is a feature(bug) in TextField. one method of achieving this is to write a listener which is called whenever a char is entered and process the length. this is nothing but implementing the Length property by yourself.

Kalyan

k_venkurao
May 6th, 2000, 05:43 AM
hello,

it is better to use java.awt.event.KeyEvent.conume() to stop entry
into textfield after some length();

have good programming
k_venkurao