HTMLTableCell class

The HTMLTableCell class takes any HTMLTagElement object as input and creates the table cell tag with the specified element. The element can be set on the constructor or through either of two setElement() methods.

Many cell attributes can be retrieved or updating using methods that are provided in the HTMLTableCell class. Some of the actions you can do with these methods are:

The following example creates an HTMLTableCell object and displays the tag:

    //Create an HTMLHyperlink object.
    HTMLHyperlink link = new HTMLHyperlink("http://www.ibm.com",
                        "IBM Home Page");
    HTMLTableCell cell = new HTMLTableCell(link);
    cell.setHorizontalAlignment(HTMLConstants.CENTER);
    System.out.println(cell.getTag());
    

The getTag() method above gives the output of the example:

<td align="center"><a href="http://www.ibm.com">IBM Home Page</a></td>