That's a little too low level, you should check the javadoc for
PushButton and CustomButton.Face:

This will give you programmatic access to the "up face" (the default
look of your pushButton)
http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/gwt/user/client/ui/CustomButton.html#getUpFace%28%29
And with that, you can change the look of the face:
http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/gwt/user/client/ui/CustomButton.Face.html

All reference removal will be taken care of by GWT if you use those
methods. From reading your last posts I get the impression that you're
quite wary of javascript memory leaks, so make sure you read the
following wiki article to better understand the strategies used by GWT
to avoid memory leaks (it'll also make you more confident on GWT):
http://code.google.com/p/google-web-toolkit/wiki/DomEventsAndMemoryLeaks

Hope that helps,

Salvador

On May 4, 12:35 pm, Engidea-GWT <goo...@engidea.com> wrote:
> 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 Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to