Sorry about the red box, but we really need you to update your browser. Read this excellent article if you're wondering why we are no longer supporting this browser version. Go to Browse Happy for browser suggestions and how to update.

Eyelid Field Manager sample app

The eyelid field sample application demonstrates how to use the EyelidFieldManager class to display fields on a pair of managers that appear temporarily at the top and bottom of the screen.

When a BlackBerry device user moves the trackpad or trackball, or when the user touches the screen (on a BlackBerry device with a touch screen), the managers are displayed temporarily on the top and bottom of the screen. While the managers are visible, the user can interact with the fields that appear on each manager. The user can also control the appearance of the managers by selecting or clearing check boxes that appear in the center of the screen.

For more information about displaying fields and managers in a BlackBerry device application, see the UI and Navigation Development Guide.

File name

Description

EyelidFieldDemo.java

This file defines the EyelidFieldDemo class.

The EyelidFieldDemo class extends the UiApplication class to support a UI and contains the following constructor and methods:

  • main (string[] args): provides the entry point to the sample application and starts the main thread for the application using enterEventDispatcher() from UiApplication
  • EyelidFieldDemo(): constructs a new EyelidFieldDemo object, and creates an EyelidFieldDemoScreen object and displays it

EyelidFieldDemoScreen.java

This file defines the EyelidFieldDemoScreen class and the CustomEditField, CustomLabelField, and SimpleButton nested classes.

The EyelidFieldDemoScreen class extends the MainScreen class to support screen characteristics that are common to BlackBerry device applications and contains the following constructor and methods:

  • EyelidFieldDemoScreen(): constructs a new EyelidFieldDemoScreen object, and contains the code that initializes an EyelidFieldManager object, creates several types of fields (for example, a CustomLabelField object, CustomEditField object, and so on), adds these fields to the EyelidFieldManager, and creates CheckboxField objects to control the appearance of the EyelidFieldManager
  • fieldChanged(Field field, int context): implements fieldChanged(Field field, int context) of the FieldChangeListener interface so that when a BlackBerry device user selects or clears the check boxes that the CheckboxField objects represent, the sample application performs the appropriate action for each check box

This sample features the following classes:

net.rim.device.api.ui.extension.container.EyelidFieldManager

This class displays fields on a pair of managers that appear temporarily at the top and bottom of the screen. You can add a field to the top manager or bottom manager by invoking addTop(Field field) and addBottom(Field field), respectively. You can also add a field at an absolute position by invoking add(Field field, int x, int y), which is inherited from the AbsoluteFieldManager class.

By default, the managers appear when a BlackBerry device user moves the trackpad or trackball, or touches the screen. The managers disappear after a period of inactivity (by default, 1.2 seconds). You can change the amount of time that the managers are displayed by invoking setEyelidDisplayTime(int time), and you can show or hide the managers manually by invoking setEyelidsVisible(boolean visible).

The sample application adds the following fields to the screen:

  • Four fields to the top manager (two CustomLabelField objects, a SeparatorField object, and a CustomEditField object)
  • Two fields to the bottom manager (a CustomLabelField object and a HorizontalFieldManager object that contains three SimpleButton objects)
  • Two CheckboxField objects at absolute positions

Install the sample app

In the BlackBerry Java Development Environment, open the workspace that you want to add the sample application to.

In the Files pane, right-click <workspace_name>.

Click Add project to <workspace_name>.

In the Add project to <workspace_name> dialog box, browse to the eyelidfielddemo folder. The default location of this folder is C:\Program Files\Research In Motion\BlackBerry JDE 5.0.0\samples\com\rim\samples\device\ui\eyelidfielddemo.

Click the EyelidFieldDemo.jdp file.

Click Open.

The sample is also available in github.

Run the sample app

In the BlackBerry Java Development Environment, in the workspace that you added the EyelidFieldDemo project to, right-click EyelidFieldDemo.

Click Build project.

On the taskbar, click Start > Applications > Research In Motion > BlackBerry JDE 5.0.0 > Device Simulator.

On the Home screen of the BlackBerry Smartphone Simulator, click the Downloads folder.

Click the Eyelid Field Demo icon.