This article applies to BlackBerry® devices based on Java®.
This article covers the creation of a screen with several labels, or tabs, across the top of the screen. These tabs are selected by scrolling, which controls the display of fields on the screen below the set of tabs.
The basic approach is to use a set of Managers to control the sets of Fields that appear on the Screen when a tab has been selected. Tabs are implemented as focusable LabelFields, with a FocusChangeListener doing the Manager switch when focus changes. Fields and Managers are initialized once and maintained in memory to retain state changes between tabs.
A HorizontalFieldManager contains the tabs at the top of the screen, with simple non-focusable separators between, and a SeparatorField below. Below this is a VerticalFieldManager initialized to the first tab view. The LabelFields have a focus listener set on them. When the listener's focusChanged() method is fired, the main VerticalFieldManager is removed from the screen, set to the VerticalFieldManager associated with the tab that now has focus, and then added back to the screen.