LIMIT THE AMOUNT OF CHARACTERS TO ENTER AN EDITABLE JCOMBOBOX

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

LIMIT THE AMOUNT OF CHARACTERS TO ENTER AN EDITABLE JCOMBOBOX

TONO2
I have a ComboBox with the option of editable, activated.

I need to limit the number of characters that the user can dial to 20.

I understand that in the properties there must be something to indicate it.

Do you know how the properties or the code are modified?

Thanks and regards




Reply | Threaded
Open this post in threaded view
|

Re: LIMIT THE AMOUNT OF CHARACTERS TO ENTER AN EDITABLE JCOMBOBOX

Eduard
AFAIK no generic system for properties does exist to do what you want.

The normal way to achieve this is by intercepting the KeyDown event that
the ComboBox receives as the user types its input.
The intercepting handler counts the input characters and if more than
the limit have been input it doesn't pass the event on and no more text
gets added.

Off course, you could create your own property with a value for the  
maximum number of characters to enter. If you have multiple text entry
fields you could create a property for each of them, and one as default
value. In that case you will need an identification for each text entry
field.

Cheers
Eduard de Jong

TONO2 wrote:

> I have a ComboBox with the option of editable, activated.
>
> I need to limit the number of characters that the user can dial to 20.
>
> I understand that in the properties there must be something to indicate it.
>
> Do you know how the properties or the code are modified?
>
> Thanks and regards
>
>
>
>
>