HTMLImage class

The HTMLImage class allows you to create image tags for your HTML page. The HTMLImage class provides methods that allow you to get and set image attributes, including the following:

The following example shows one way to create an HTMLImage object:

    // Create an HTMLImage.
    HTMLImage image = new HTMLImage("http://myWebSite/picture.gif", "Alternate text for this graphic");
    image.setHeight(94);
    image.setWidth(105);
    System.out.println(image);

The print statement produces the following tag on a single line. Text wrapping is for display purposes only.

    <img src="http://myWebSite/picture.gif" 
         alt="Alternate text for this graphic"
         height="94" width="105" />