Interface IImage

All Superinterfaces:
IAnyGroup<IImage>, IComponent<IImage>, IHtmlBasedComponent<IImage>, IImageBase<IImage>, IXulElement<IImage>

public interface IImage extends IImageBase<IImage>, IAnyGroup<IImage>
Immutable Image component

An IImage component is used to display an image at the browser. There are two ways to assign an image to an image component. First, you could use the of(String) or IImageBase.withSrc(String) to specify a URI where the image is located. This approach is similar to what HTML supports. It is useful if you want to display a static image, or any image that can be identified by URL. For example:

 @RichletMapping("/example")
 public IComponent example() {
     return IImage.of("/stateless/ZK-Logo.gif");
 }
 
 

Secondly, you could use the IImageBase.withContent(org.zkoss.image.Image) or IImageBase.withContent(RenderedImage) method to set the content of an image to an image component directly.

Author:
katherine
See Also:
  • Image
  • Field Details

    • DEFAULT

      static final IImage DEFAULT
      Constant for default attributes of this immutable component.
  • Method Details

    • getWidgetClass

      default String getWidgetClass()
      Returns the client widget class.

      Default: "zul.wgt.Image"

      Specified by:
      getWidgetClass in interface IComponent<IImage>
    • of

      static IImage of(String src)
      Returns the instance with the given src.
      Parameters:
      src - The URI of the image source.
    • ofSize

      static IImagemap ofSize(String width, String height)
      Returns the instance with the given width and height.
      Parameters:
      width - The width of the image.
      height - The height of the image.
    • ofId

      static IImage ofId(String id)
      Returns the instance with the given id.
      Parameters:
      id - The id to identify this component