PDA

View Full Version : [FIXED] Bug in Button.setText() clears icon image



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 = "&nbsp;";
}
buttonEl.update(text);
setIcon(icon); // fixed bug with setText() clearing icon
autoWidth();
}
}

sven
10 Jul 2009, 5:02 PM
Fixed in SVN.