I am trying to create simple html table.

Code for table:

public class SimpleTable extends Widget {
    private Element tr;

    public SimpleTable() {
        Element tableElem = DOM.createTable();
        Element bodyElem = DOM.createTBody();
        DOM.appendChild(tableElem, bodyElem);
        setElement(tableElem);

        tr = DOM.createTR();
        DOM.appendChild(bodyElem, tr);
    }

    public void addCell(String text) {
        Element td = DOM.createTD();
        td.setInnerText(text);
        DOM.appendChild(tr, td);
    }
}

Code for extended class:

public class TimeLine extends SimpleTable {
    public TimeLine() {
        addCell("text 1");
    }
}

But addCell(String text) method does not append new td element to the
table. What is wrong with code?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to