Mohamed Sobhy
Mohamed Sobhy

Reputation: 395

LWUIT menuBar refreshTheme not working?

I'd like to dynamically change the text of a Command depending on some state, so normally I went to Google and LWUIT blogs said that using refreshTheme() on MenuBar should do the trick. So I used the following code, but it sadly didn't work

if (isPlaying) {
          playButton.setCommandName("Pause");
}else{
          playButton.setCommandName("Play");
}
this.getMenuBar().refreshTheme();

Is there something wrong with my code? Or did I misunderstand something?

Upvotes: 1

Views: 50

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

It won't refresh. The text of the button is set when the command is placed so you can't do that.

You will need to use removeCommand(cmd) followed by addCommand(newCmd).

Furthermore, refreshTheme() has absolutely nothing to do with anything.

Upvotes: 1

Related Questions