views:

34

answers:

2

This is my screen:

final class GeneralExpenseViewScreen extends MainScreen {
    public GeneralExpenseViewScreen() {
        super();
        LabelField title = new LabelField("TeamMate TEC | Expenses",
                LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
        setTitle(title);

        Background bg = BackgroundFactory.createSolidBackground(0xBDBDDB);
        setBackground(bg);

        HorizontalFieldManager headerAreaManager = new HorizontalFieldManager();
        HorizontalFieldManager filterAreaManager = new HorizontalFieldManager();
        HorizontalFieldManager expenseListAreaManager = new HorizontalFieldManager();
        HorizontalFieldManager totalAreaManager = new HorizontalFieldManager();
        HorizontalFieldManager addNewAreaManager = new HorizontalFieldManager();

        add(headerAreaManager);
        add(filterAreaManager);
        add(expenseListAreaManager);
        add(totalAreaManager);
        add(addNewAreaManager);

        /**Begin form layouts**/

        Bitmap headerImage = Bitmap.getBitmapResource("sergioheader.png");
        BitmapField header = new BitmapField(headerImage);
        headerAreaManager.add(header);

    }

    public boolean onClose() {
        Dialog.alert("AH!");
        System.exit(0);
        return true;
    }
}

Notice that I'm calling setBackground directly to the class but it's not working how I think it would work.

How can I set a background color to my application form?

Thanks.

+1  A: 

I've used this code with success:

protected void paint(Graphics graphics) {
    graphics.setBackgroundColor(0xBDBDDB);
    graphics.clear();
    super.paint(graphics);
}
Marc Novakowski
Can you define "some success"? What does that mean?
Serg
edited to remove "some" :)
Marc Novakowski
A: 

Depending on the version you're developing for, you could use

getMainManager().setBackground(BackgroundFactory.createSolidBackground(Color.BLACK);

to set the screen managers background color.

endevour