Name

ImageItem

Synopsis

This class is a subclass of Item that displays an Image as well as the optional label provided by Item. The image to be displayed is supplied as an instance of the Image class and must be immutable. It is also possible to supply an alternate text string that is displayed in place of the image if the platform does not support images. These attributes are usually set at construction time, but may be changed later using the setImage() and setAltText() methods.

By default, an ImageItem that has a null or empty label is placed on the same line as any preceding StringItem or ImageItem, provided that there is room to accomodate the image. If there is insufficient room, then a line break will occur. The application may request that a different layout policy be applied by supplying an explicit layout argument to the constructor or using the setLayout() method.

The layout value consists of an optional alignment value together with an optional request for line breaks. The alignment value must be one (and only one) of the following:

LAYOUT_DEFAULT

Applies the default layout policy described above

LAYOUT_LEFT

Left justifies the image within the space allocated to it.

LAYOUT_RIGHT

Right justifies the image within the space allocated to it.

LAYOUT_CENTER

Centers the image within the space allocated to it.

A line break can be requested before and/or after the ImageItem by including the values LAYOUT_NEWLINE_BEFORE and LAYOUT_NEWLINE_AFTER in the layout value. The value ...

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.