Custom BlackBerry ButtonField

UI controls in the BlackBerry SDK don’t give you a lot of customization options specially in versions prior to 5. To do something as simple as changing the background color or focus color you will have to subclass that UI control and draw everything yourself.

To make our lives easier, I intend to create a set of custom controls that are easily customizable just by setting a set of properties, the first of which is a custom ButtonField which lets you easily set background and focus image/color, draw rounded edges, change size, and change font.

I’ve added the source code along with a usage example to a GitHub repo and I will be adding more controls later on.

Grab the code here:

Update: I’ve added the ability to initialize the button with two URLs for background and focus images, which will be automatically downloaded.