I discovered that there are cases when an icon may not be there in the
first place.
A better setIcon is the following

  public void setIcon ( Image icon )
    {
    // make sure that any previous association of icon is gone.
    icon.removeFromParent();

    // get the element of this button
    Element element = getElement();

    // can this happen ???
    if ( element == null ) return;

    // get the icon that was associated with this element, if any
    Node oldIcon = element.getFirstChild();
    if ( oldIcon == null )
      element.appendChild( icon.getElement());
    else
      element.replaceChild(icon.getElement(),oldIcon);
    }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to