This article applies to BlackBerry® wireless devices based on Java™.
A BitmapField can handle focus changes in a similar fashion to other fields in the BlackBerry application programming interface (API) set. When in focus, a BitmapField does not draw a border around the field to show it has focus. Instead, the transparent regions of the image are highlighted, in the same manner as the selected icons on the BlackBerry device Home screen. If you want to visually represent the focus status of a BitmapField, the image used in the BitmapField must contain a transparent area.
Another option to create a visual indication of focus changes is to override the onFocus and onUnfocus methods and provide custom visual indication, such as changing the bitmap shown in the field. The following code sample depicts how to change the bitmap of a Bitmap field when it gains or loses focus.
Bitmap bm1 = Bitmap.getBitmapResource("focusImage.png");
Bitmap bm2 = Bitmap.getBitmapResource("unFocusImage.png");
BitmapField bmField1 =
public void onFocus(int direction)
public void onUnfocus()