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.

Was this information helpful? Send us your comments.