1

I'm new in LWUIT. I have created a theme for my MIDlet and applied it. The background of the Form, the Label and font change as defined in the theme but the Buttons on the Form do not change like I have defined them in my theme. What could be the problem? Here is a snippet of my code.

import com.sun.lwuit.Button;
import com.sun.lwuit.Display;
import com.sun.lwuit.Form;
import com.sun.lwuit.plaf.UIManager;
import com.sun.lwuit.util.Resources;
import java.io.IOException;
import javax.microedition.midlet.MIDlet;

public class mainMidlet extends MIDlet {

public void startApp() 
{

    Display.init(this);

    Resources r;
    try {
        r = Resources.open(getClass().getResourceAsStream("res/TUNGtheme.res"));
        UIManager.getInstance().setThemeProps(r.getTheme("Theme 2"));
    } catch (IOException ex) {
        //do something

    }

Form f = new Form("App using LWUIT!");
f.show();

Button tuskysButton = new Button("Tuskys");
f.addComponent(tuskysButton);

}

public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
}
}
Mun0n
  • 4,438
  • 4
  • 28
  • 46
Janta
  • 11
  • 3

2 Answers2

1

I suppose that the UIID that you defined for the Buttons has the right name. I mean in the ResourceEditor you have to apply the style for elements called Button. If that is right, did you set selected and unselected style? If I can see a pair of screens from your Resource Editor, I could help you more.

Mun0n
  • 4,438
  • 4
  • 28
  • 46
1

I'm guessing the Button is focused and you only defined the unselected style and not the selected/pressed styles.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65