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) {
}
}
4

2 に答える 2

1

に定義した UIID のButtons名前は正しいと思います。ResourceEditor では、 という要素にスタイルを適用する必要がありますButton。そうである場合、選択スタイルと非選択スタイルを設定しましたか? リソース エディタから 2 つの画面を確認できれば、さらにお役に立てます。

于 2012-03-13T00:01:09.490 に答える
1

ボタンがフォーカスされていて、選択/押されたスタイルではなく、選択されていないスタイルのみを定義したと思います。

于 2012-03-14T03:55:42.047 に答える