Name
StringItem
Synopsis
StringItem
is a subclass of Item
that
displays a string as well as the label associated with its superclass. The
string to be displayed can be set using the setText()
and
retrieved using getText()
. In normal use, the label would
remain unchanged and would describe the meaning of the text, which would vary
depending on context. Typical usage might be to set the label to Address:
and display an address using the text part of the StringItem
.
The platform may choose to render the label and the text differently so as to highlight the distinction between them, but is not obliged to do so. The MIDP for PalmOS implementation, for example, uses a bold font for the label.
Placing a StringItem
with a null
or empty label
on a Form
does not cause
a line break, so that successive StringItem
s (or
ImageItem
s) that do not have labels
may appear together on the same line if there
is room. Newline characters may be embedded anywhere within the label or the
text to force a line break to occur. Where a line break is required because there
is insufficient space, the implementation will normally break at whitespace, where
possible.
public class StringItem extends Item { // Public Constructors public StringItem( String label, String text); // Public Instance Methods public String getText(); public void setText( String text); // Public Methods Overriding Item public void setLabel ...
Get J2ME in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.