开发者

How to put Image on Buttonfield and add events

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?开发者_StackOverflow


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜