setting the max of TextField
Hi, how do I set the max of a textfield? I've read through the docs and I've tried getPreferredSize but that doesn't seem to work. Any ideas?
To set a max number of characters to a textfield, you'll need to go through the event listener. I don't know off hahnd which one though. A textfield (or any input filed for that matter) throws an event each time a character is typed. You can listen for this event, and take action when it occurs. In your case, the appropriate action would be to erase the lastly typed character (and maybe show a small popup stating no more characters)
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center