if (c instanceof SContainer) {
if (c instanceof SContainer && c.isVisible()) {
    public void write(Device d, SLayoutManager l)        throws IOException    {        SGridLayout layout = (SGridLayout)l;        SContainer container = layout.getContainer();        List components = layout.getComponents();        boolean header = layout.getHeader();        boolean relative = layout.isRelative();        int width = layout.getWidth();        int cellSpacing = layout.getCellSpacing();        int cellPadding = layout.getCellPadding();        int border = layout.getBorder();        int cols = layout.getColumns();        int rows = layout.getRows();        d.print("\n<table ");        if ( Utils.hasSpanAttributes( container ) )         {         	d.print("style=\"");        	Utils.writeSpanAttributes( d, (SComponent) container );            d.print("\" ");		 }        if (cellSpacing >= 0)            d.print(" cellspacing=\"").print(cellSpacing).print("\"");        else            d.print(" cellspacing=\"0\"");        if (cellPadding >= 0)            d.print(" cellpadding=\"").print(cellPadding).print("\"");        else            d.print(" cellpadding=\"0\"");                CGUtil.writeSize( d, container );        if (border > 0)            d.print(" border=\"").print(border).print("\"");        else            d.print(" border=\"0\"");        if (container != null && container.getBackground() != null)            d.print(" bgcolor=\"#").                print(Utils.toColorString(container.getBackground())).print("\"");        d.print(">\n");        if (cols <= 0)            cols = components.size() / rows;        boolean firstRow = true;        int col = 0;        for (Iterator iter = components.iterator(); iter.hasNext();) {            if (col == 0)                d.print("<tr>");            else if (col%cols == 0 && iter.hasNext()) {                d.print("</tr>\n<tr>");                firstRow = false;            }            SComponent c = (SComponent)iter.next();            if (firstRow && header) {                d.print("<th");                Utils.printTableCellAlignment(d, c);                // Some containers (like SPanel) do not support background colors                // hence we support the background of them using the sourrounding gridlayout cell                if (c instanceof SContainer) {                   Utils.printTableCellColors(d, c);                }                d.print(">");                            }            else {                d.print("<td");                Utils.printTableCellAlignment(d, c);                // Some containers (like SPanel) do not support background colors                // hence we support the background of them using the sourrounding gridlayout cell                if (c instanceof SContainer) {                   Utils.printTableCellColors(d, c);                }                d.print(">");            }            c.write(d);            if (firstRow && header)                d.print("</th>");            else                d.print("</td>");            col++;            if (!iter.hasNext())                d.print("</tr>\n");        }        d.print("</table>");    }