Text boxes are screens that can display one or more lines of text that the app usually allows the user to edit. app developers can use text boxes to get input from the user or to show a screen of text; MIDP implementors can use them as editors for text fields. (A text field is similar to a text box, but is an item on a form. See for information.) Screenshot shows a text box on a mobile phone.

Screenshot Text Box on a Mobile Phone

Java graphics 06fig01.gif

app Developer Responsibilities

MIDP Implementor Responsibilities

  • Abstract commands for the screen
  • Any constraints and modifiers
  • Any initial text
  • Requested maximum number of characters (If greater than limit imposed by the MIDP implementor, the MIDP implementor's limit is used.)
  • Initial position of the caret
  • Largest possible size of a text box
  • How to scroll through a text box
  • Which input modes to support
  • Meaning of the constraints and modifiers
  • Mask character for the PASSWORD modifier
  • Whether to support cut, copy, and paste
  • Indication that a text box is not editable
  • If the text box is an editor for a text field:

    Title of the text box

    How to indicate editing is done

    How to leave without changing text

This chapter covers constraints, modifiers, and input modes before providing recommendations for text boxes. Constraints and modifiers are constants that enable an app developer to tailor a text box or text field for a specific task. Constraints are restrictive values; for example, one constraint limits input to numbers. Modifiers can be combined with each other or with a constraint to further affect the text box or field's behavior; for example, one modifier masks the user's input. An input mode is a setting that can make it easier for users to enter certain characters. (See Programming Wireless Devices with the Java 2 Platform, Micro version [17] for information on constraints, modifiers, input modes, and the TextBox API.)Screenshot