0
votes

I am doing a Blackberry application.In my application i have to show show some text under a image. So i used this code.

LabelField tab1 = new LabelField("Page 1", LabelField.FOCUSABLE | LabelField.HIGHLIGHT_SELECT){


        protected void paintBackground(Graphics g) {
            // TODO Auto-generated method stub
            super.paintBackground(g);
            EncodedImage tmpimg =    EncodedImage.getEncodedImageResource("ic_menu_refresh.png");
            try {
                g.drawImage(0, 0, 70, 40, tmpimg,0 , 0, 0);

            }
            catch (IllegalArgumentException iae) {
                System.out.println("Bad arguments."); 
            }
        }


        protected void layout(int width, int height) {
             super.layout(width, height);
                setExtent(70, 40);
        };

        protected void paint(net.rim.device.api.ui.Graphics graphics) {
            graphics.setColor(Color.WHITE);
            super.paint(graphics);
        };


    };

This code giving text on limage but i want that text not on center of the image .I want it on bottom of the image. Also i want to resize the image depends on labelfield size..Please help me friends..

1

1 Answers

1
votes

You can also achieve same thing by extending Field class . Make your own custom Field . and override paint() method . in that draw bitmap and text using coordinate (x,y).

hope

it will help you...... !!