views:

33

answers:

1

I want to develop a java application.

How can I create an imagebutton? How do I put an Image on a ButtonField, and add click and navigate events to it?

+2  A: 

There's plenty of material out there on how this could be accomplished. You can override extend ButtonField and override its paint method to do what you want. You can use a BitmapField and provide the entire image for your button. Here are some links that should help:

http://www.coderholic.com/blackberry-custom-button-field/

http://stackoverflow.com/questions/1706241/blackberry-buttonfield-with-centered-bitmap

Then for implementing navigation functionality, you need to override the navigation methods provided by Field. Such methods include Field#navigationClick(int, int) and Field#keyDown(int, int). Here's a link to the JavaDocs for Field.java.

http://www.blackberry.com/developers/docs/6.0.0api/net/rim/device/api/ui/Field.html

Fostah
Thank you very much.It's very helpful links.