idajali
10 Jul 2009, 1:49 PM
When [re]setting the text on a Button via the setText() method, the icon image is cleared out (since setText() calls DOM.setInnerHtml() and the <img> tag is part of the innerHtml). To fix this, I found that adding the line:
setIcon(icon);
in the method as follows corrects this problem:
public void setText(String text) {
this.text = text;
if (rendered) {
if (text != null && text.equals("")) {
text = " ";
}
buttonEl.update(text);
setIcon(icon); // fixed bug with setText() clearing icon
autoWidth();
}
}
setIcon(icon);
in the method as follows corrects this problem:
public void setText(String text) {
this.text = text;
if (rendered) {
if (text != null && text.equals("")) {
text = " ";
}
buttonEl.update(text);
setIcon(icon); // fixed bug with setText() clearing icon
autoWidth();
}
}