code: public void setStretch(boolean stretch) {
          this.stretch = stretch;
          image.setWidth(stretch ? "100%" : null);
          image.setHeight(stretch ? "100%" : null);
      }
docs: Sets whether or not to stretch the image to fill its parent.
  
  @param stretch Stretch setting.