开发者

Label field with just an image

开发者 https://www.devze.com 2023-02-19 01:42 出处:网络
How can I add a Fie开发者_Go百科ld that is just an image ? I;ve being try to override paint in LabelField but its not working -

How can I add a Fie开发者_Go百科ld that is just an image ? I;ve being try to override paint in LabelField but its not working -

import net.rim.device.api.system.EncodedImage;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.component.LabelField;

    public class CustomLabelField extends LabelField{

        private EncodedImage image;

        public CustomLabelField (EncodedImage image){

            super("",HCENTER | ELLIPSIS );     
            this.image = image;     
        }        

        public void paint(Graphics graphics){
            graphics.drawImage(0, 0, image.getWidth(), image.getHeight(), image, 0, 0, 0);  
        }

Thanks


Have you tried using the BitmapField? If you only need an image this is the object to use.

0

精彩评论

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