A manager is a container that you can use to arrange fields on the screen of a BlackBerry device. The fields that a manager contains are called the manager's controlled fields. Every field on a screen can be controlled by only one manager.
A manager is represented by the Manager class, which is included in the net.rim.device.api.ui package. The BlackBerry Java SDK includes several types of managers that extend this class, including the HorizontalFieldManager, VerticalFieldManager, and FlowFieldManager classes. Because managers are derived from the Field class, they can be nested. For example, you can create a horizontal field manager that consists of three vertical field managers, each of which contains its own fields. Using this approach, you can create complex layouts with very little code.
Constructors for the various manager classes can accept style bits as parameters that specify the scrolling behavior of the manager. For example, you can specify Manager.HORIZONTAL_SCROLL to indicate that the manager should allow horizontal scrolling if it contains fields that are wider than the manager's visible area. Similarly, you can specify Manager.VERTICAL_SCROLL to indicate that the manager should allow vertical scrolling if it contains fields that are taller than the manager's visible area. If you do not specify that a manager should allow scrolling, the screen displays as many fields as possible within the available screen space, and the rest of the fields are not shown. The fields exist but are not visible to the BlackBerry device user. This situation can create unexpected scrolling behavior for users.
The Manager class is an abstract class. You can use the managers that are included in the net.rim.device.api.ui.container package in your applications, or you can extend the Manager class to create your own custom manager. If you choose to create a custom manager, you must implement sublayout(). The sublayout() method specifies how the manager arranges its controlled fields, including the size and position of each field.
Vertical field manager
A vertical field manager is represented by the VerticalFieldManager class. This layout manager arranges fields in a single vertical column starting at the top of the screen and ending at the bottom of the screen. Because this layout manager is designed to arrange fields vertically, you can apply horizontal style bits, but not vertical style bits, to the fields that this manager contains. For example, you can apply Field.FIELD_LEFT, Field.FIELD_RIGHT, or Field.FIELD_HCENTER style bits, but you cannot apply Field.FIELD_TOP, Field.FIELD_BOTTOM, or Field.FIELD_VCENTER style bits.
Horizontal field manager
A horizontal field manager is represented by the HorizontalFieldManager class. This layout manager arranges fields in a single horizontal row starting at the left side of the screen and ending at the right side of the screen. Because this layout manager is designed to arrange fields horizontally, you can apply vertical style bits, but not horizontal style bits, to the fields that this manager contains. For example, you can apply Field.FIELD_TOP, Field.FIELD_BOTTOM, or Field.FIELD_VCENTER style bits, but you cannot apply Field.FIELD_LEFT, Field.FIELD_RIGHT, or Field.FIELD_HCENTER style bits.
Flow field manager
A flow field manager is represented by the FlowFieldManager class. This layout manager arranges fields vertically and then horizontally depending on the size of the screen. The first field is positioned in the upper-left corner of the screen and subsequent fields are placed horizontally to the right of the first field until the width of the screen is reached. Once fields can no longer fit on the first row, the next field is placed below the first row of fields on a row that has a height that is equal to the tallest field of the row above it. You can apply vertical style bits, such as Field.FIELD_TOP, Field.FIELD_BOTTOM, or Field.FIELD_VCENTER, to align fields vertically within their row.