tipycalFlow
tipycalFlow

Reputation: 7644

Blackberry input field that mimics the input field of Android

I'm trying to make a login screen for Blackberry with input fields for username and password that look like the the editText field of android. Basically, there should be a well defined background and default prompt text in a different color when no text has been input. Unfortunately, I couldn't find a default field provided by blackberry. I'm currently using an EditField and a PasswordEditField with BorderFactory to provide the demarcation. Is anyone aware of such libraries or some other open source efforts by someone to do so? Please point me to any tutorial, etc too.

Thanks!

Upvotes: 0

Views: 215

Answers (1)

donturner
donturner

Reputation: 19146

You will need to write your own custom field which extends EditField.

http://docs.blackberry.com/en/developers/deliverables/11958/Create_a_custom_field_508117_11.jsp

My suggestions are:

  1. Override the Field.paint() method to place the label inside the text box (rather than to the left of it which is the default behaviour). This is where your instruction to the user can go, ie the 'Username' or 'Password' text.
  2. Override the Field.onFocus() method to remove the instruction from the text box. Conversely override the Field.onUnfocus() method to add it back in if the user moves to another text box without entering any text.

Upvotes: 1

Related Questions