10.3. ImageItem

Image objects can be added to a Form either directly as an Image or as an ImageItem. ImageItem is a simple class that wraps an Image. By default, the ImageItem is placed next to the previous StringItem or ImageItem. If an ImageItem is wider than the horizontal space available in the row, it is placed in a new row. Images wider than the Form width are clipped.

The ImageItem can be given a preferred layout policy with the setLayout method. The directive passed to this method defines whether the image is centered within the Form margins (LAYOUT_CENTER), left-justified (LAYOUT_LEFT), or right-justified (LAYOUT_RIGHT) and whether a forced line break is created before or after the image (LAYOUT_NEWLINE_BEFORE, LAYOUT_NEWLINE_AFTER

Get Programming Wireless Devices with the Java™ 2 Platform, Micro Edition, Second Edition 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.