New line handling

The following table lists the line separators and the corresponding new line character combinations supported by LCDUI.

Line separator

New line escape in Java code

Unicode value

CR (Carriage Return)

\r

U+000D

CRLF (Carriage Return + Line Feed)

\r\n

U+000D, U+000A

LF (Line Feed)

\n

U+000A

LS (Line Separator, only in Unicode)

\u2028

U+2028

As a rule, each new line character combination results in exactly one forced line break when used in a String or character array that is displayed on the screen by a UI component. However, there are some exceptions when a new line character combination is not displayed as line break. The following sections describe these exceptions.

Command labels

In a Command label, each new line character combination is displayed as a box glyph (an empty rectangle).

Displayable

If there is only one line available for the title of a Displayable, any new line character combinations are displayed as white spaces (U+0020). If there are multiple lines available for the title, each new line character combinations forces a line break, unless the new line character combination is on the last available line, in which case it is displayed as a white space.

Graphics

The Graphics.drawChars, Graphics.drawString, and Graphics.drawSubstring methods display each new line character combination as a box glyph (an empty rectangle).

List and ChoiceGroup

If the fit policy of a ChoiceGroup or List is set to TEXT_WRAP_ON, each new line character combination in an element forces a line break in the displayed text. If the fit policy is set to TEXT_WRAP_OFF, the element text is limited to a single line and cropped if necessary. If the text contains a new line character combination in the first line, the text is cropped from the new line character combination onwards. The cropping is indicated by an ellipsis ("...").

Note: If you are developing your MIDlet for Symbian devices that do not provide a pop-up window for viewing the full element text in case the displayed text is cropped, make sure that the user can view the full text by some other means, or limit the length of the full text.

Ticker

In a Ticker, each new line character combination is displayed as a white space on Series 40 devices and as a box glyph (an empty rectangle) on Symbian devices.