SoH
SoH

Reputation: 2190

Change background of LWUIT Dialog

I am having trouble changing the background color of Dialog from white to any color. I have tried the following code snippets but to no use.

dialog.getDialogStyle().setBgColor(0xffce78, true);
    dialog.getUnselectedStyle().setBgImage(Image.createImage("/main_bg.png"));
        dialog.getPressedStyle().setBgImage(Image.createImage("/main_bg.png"));
        dialog.getSelectedStyle().setBgImage(Image.createImage("/main_bg.png"));

Upvotes: 1

Views: 699

Answers (2)

Shai Almog
Shai Almog

Reputation: 52760

You need to use the dialog style getDialogStyle().

Regardless your code creates 3 separate yet identical images which is REALLY BAD! You are loading the same image 3 times into memory!

Upvotes: 3

Mun0n
Mun0n

Reputation: 4437

Is you image in the root directory? You should use the full path from the src folder, I mean, if your image is in the "images" package, you should put this path "/images/main_bg.png". If it is in the default package...."main_bg.png"

Upvotes: 0

Related Questions