Dynamic icon for a button...

How to make the icon for a button dynamic?

After I click the button. It should use another icon.

The simplest way would be just changing the icon in the buttonClick method of the ClickListener. E.g. like the following.

final Button myButton = new Button (“A bug”);
myButton.addClickListener(new Button.ClickListner() {
public void buttonClick(ClickEvent e) {