Form

If a MIDlet requires having several UI components on the screen at the same time, they can be implemented using Forms. In a similar way to other high-level APIs, Forms also take up the whole display area but in that area they can contain a number of different UI elements, for example sliders, pop-up lists and text fields. Forms offer a way to handle data and user input in a more complex way.

All Form elements are derived from the superclass Item. The Form Items are presented in the main pane, which can be scrolled vertically if all the components do not fit otherwise. Text is wrapped and images are clipped if the content exceeds the horizontal space. Items are laid out to the main pane from top to bottom and left to right, by default. An Item is focused when the user has navigated to it using the arrow keys and a highlight box indicates the Item has been focused on. Items can be editable or non-editable. All Items have a label, which is null by default. If an item has a label, it is displayed on a line below the rest of the item.

All editing in a Form takes place inline and all editable Items are focusable. Also the non-editable Items StringItem and ImageItem can be focusable if there are one or more Commands set to them and ItemCommandListener is registered. CustomItem is focusable if its traverse method returns true.

In Form navigation, the Arrow up and Arrow down keys move the focus, scroll form, or do both. The key behavior (the Selection key, the Arrow left and Arrow right keys) on a focused item varies from component to component. Form navigation does not loop.

Forms can contain the following Items:

Empty Forms (Forms with no Items) are presented with the text no data.

For more information about S60-specific Form features, see Form implementation notes.