tags:

views:

84

answers:

2

Hi i'm new to blackberry application development Please can you tell me how i'm i to customize my components. for eg i need a verticalfieldManager, which will have a label field, a image, placed one after the other. Also this verticalFieldManager should be in the center of the screen, it should not start from the immediate left or right of the screen

Also i want a border for this verticalFieldManager.

A: 

No need customized the class. Hope, the following code will solve your problem.

public class Sample extends UiApplication {
public Sample() {
    pushScreen(new SampleScreen());
}
public static void main(String[] args) {
    Sample sample = new Sample();
    sample.enterEventDispatcher();
}
private static class SampleScreen extends MainScreen {

    public SampleScreen() {

        VerticalFieldManager vfManager = new VerticalFieldManager(Field.FIELD_HCENTER);
        vfManager.add(new LabelField("Test Label"));
        vfManager.add(new BitmapField(Bitmap.getBitmapResource("image.png")));
        vfManager.setBorder(BorderFactory.createRoundedBorder(
                new XYEdges(5, 5, 5, 5),
                Color.ORANGE,
                Border.STYLE_SOLID
            ));
        add(vfManager);
    }
}

}

Karthik
A: 

Hi,

It should be noted that the BorderFactory class wasn't added until JDE 4.6.0. If you are your application on a older JDE platform then you will have to override the vertical manager's paint method to draw the border.

-Glen

Glen Morgan
You should add this as a comment to Karthik's answer, not as it's own answer.
Marc Novakowski
Sorry about that however I didn't and still don't see an option to comment on Karthik's answer. However I did see one to comment to your response. The only options I see on Karthik's answer are "link | flag". Maybe I'm missing something.
Glen Morgan