0

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?

Michael Donohue
  • 11,776
  • 5
  • 31
  • 44
user460397
  • 23
  • 7

1 Answers1

2

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/

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

Community
  • 1
  • 1
Fostah
  • 11,398
  • 10
  • 46
  • 55