Search code examples
user-interfaceblackberryjava-meblackberry-storm

Customized Checkboxes


I am trying to implement image as checkbox.

I have a list with 2 columns and I want to display checbox image on right side, as a third column.On clicking that image ,the image will be changed to a different one.

In which way I can do this?


Solution

  • One way to do this would be to create a custom Field that extends BitmapField. This custom field could contain two Bitmap images (one for each state). You might even consider having four images, so that you can indicate when it has focus as well. For example: unchecked-non-focused, unchecked-focused, checked-non-focused, checked-focused.

    When you want to change the image (i.e. on a touch event or trackball click) just have your custom Field call setBitmap() with the appropriate bitmap.