Class Img

  • All Implemented Interfaces:
    IsJSType, IsCastable

    @JsType(isNative=true,
            name="HTMLImageElement",
            namespace="<global>")
    public final class Img
    extends BaseHtmlElement
    implements IsCastable
    Represents an HTML <img> element, providing the properties and methods used to manipulate image elements.
    Author:
    Andrea "Stock" Stocchero
    • Method Detail

      • getHeight

        @JsProperty
        public int getHeight()
        Returns the value that reflects the height attribute, indicating the rendered height of the image in CSS pixels.
        Returns:
        the value that reflects the height attribute
      • setHeight

        @JsProperty
        public void setHeight​(int height)
        Sets the value that reflects the height attribute, indicating the rendered height of the image in CSS pixels.
        Parameters:
        height - the value that reflects the height attribute
      • getSrc

        @JsProperty
        public String getSrc()
        Returns the full URL of the image including base URI.
        Returns:
        the full URL of the image including base URI
      • setSrc

        @JsProperty
        public void setSrc​(String src)
        Sets the full URL of the image including base URI.
        Parameters:
        src - the full URL of the image including base URI
      • getWidth

        @JsProperty
        public int getWidth()
        Returns the value that reflects the width attribute, indicating the rendered width of the image in CSS pixels.
        Returns:
        the value that reflects the width attribute
      • setWidth

        @JsProperty
        public void setWidth​(int width)
        Sets the value that reflects the width attribute, indicating the rendered width of the image in CSS pixels.
        Parameters:
        width - the value that reflects the width attribute
      • isComplete

        @JsProperty
        public boolean isComplete()
        Returns a boolean value that is true if the browser has finished fetching the image, whether successful or not.
        That means this value is also true if the image has no src value indicating an image to load.
        Returns:
        a boolean value that is true if the browser has finished fetching the image, whether successful or not