Is it possible to set caret position in TextField in J2ME? There’s a method getCaretPosition(), but I need to set it.
Is it possible to set caret position in TextField in J2ME? There’s a method
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In MIDP 2, TextField API does not provide a way for application developer to set caret position.
The most likely reason is that API designers decided that exposing such an API could led to negative user experience: imagine application suddenly moving caret from under your fingers right when you’re typing a text – that’s how
setCaretPositionwould work. If you plan something like that in your application, think twice about how it would look for its users (I for one would probably broke my phone and curse a MIDlet that would behave like that).getCaretPositionyou mentioned is to support insert API: