cb.width = 0; for (int i = 0; i < cb.colspan; i++) cb.width += tableBox.columns[col + i]; cb.width += borderSpacingHorizontal * (cb.colspan - 1);
cb.contentWidth = 0; for (int i = 0; i < cb.colspan; i++) cb.contentWidth += tableBox.columns[col + i]; cb.contentWidth += borderSpacingHorizontal * (cb.colspan - 1); cb.width = cb.contentWidth;
    private static void fixWidths(TableBox tableBox, int borderSpacingHorizontal) {        int sum = borderSpacingHorizontal;        for (int i = 0; i < tableBox.columns.length; i++) sum += tableBox.columns[i] + borderSpacingHorizontal;        if (sum < tableBox.width) {            int extra = (tableBox.width - sum) / tableBox.columns.length;            for (int i = 0; i < tableBox.columns.length; i++) tableBox.columns[i] += extra;        } else {            //if sum is greater, we probably screwed up earlier, just do something reasonable            tableBox.width = sum;        }        for (Iterator tci = tableBox.getChildIterator(); tci.hasNext();) {            Object tc = tci.next();            if (tc instanceof RowBox) {                RowBox row = (RowBox) tc;                int col = 0;                int x = borderSpacingHorizontal;                for (Iterator cbi = row.getChildIterator(); cbi.hasNext();) {                    CellBox cb = (CellBox) cbi.next();                    cb.width = 0;                    for (int i = 0; i < cb.colspan; i++) cb.width += tableBox.columns[col + i];                    cb.width += borderSpacingHorizontal * (cb.colspan - 1);                    cb.x = x;                    x += cb.width + borderSpacingHorizontal;                    col += cb.colspan;                }            } else                XRLog.layout(Level.WARNING, "Can't fix widths of " + tc.getClass().getName() + " yet!");        }    }