Friday, June 27, 2014

Re: reuse of private static variable

An element can only have one parent at a time in the DOM tree. If you add it somewhere, you (implicitly) first remove it from where it was.
By extension, this also applies to GWT widgets (which wrap a DOM element).

On Friday, June 27, 2014 1:44:25 PM UTC+2, new_newbie wrote:

I have a class that contains static private variable. If the static private variable is access somewhere as shown in BiggerPanel, the SocialScreen flexTable.setWidget will not set an image as expected. No image is put in the flextable. The SocialScreen flexTable.setWidget works if I remove the SocialScreen.getfbImage() from BiggerPanel. It seems the static private variable is not reusable. Why is it like that?


class SocialScreen extends composite
static private Image fbImage;

static public Image getFacebookImage()
        return fbImage;
public SocialScreen()
//To put the face book on the flextable
        fbImage = new Image(images.facebookIconImageData().getSafeUri());
        image = fbImage;

Class BiggerPanel
socialPanel=new SocialScreen();
acctPanel=new AcctPanel(){
    //Use the static function/static image of the SocialScreen
    Image fb=SocialScreen.getfbImage()

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment