rendererPane.writeComponent(d, renderer, list);
StringBufferDevice device = getStringBufferDevice(); renderer.write(device); char[] chars = device.toString().toCharArray(); int pos = 0; for (int c=0; c < chars.length; c++) { switch (chars[c]) { case '<': if (c > pos) d.print(chars, pos, c - 1); break; case '>': pos = c+1; } } if (chars.length > pos) d.print(chars, pos, chars.length - 1);
    public void writeFormBody(Device d, SList list)        throws IOException    {        ListModel model = list.getModel();        int size = model.getSize();        if (model != null) {            SListCellRenderer cellRenderer = list.getCellRenderer();            SCellRendererPane rendererPane = list.getCellRendererPane();            for (int i=0; i < size; i++) {                Object o = model.getElementAt(i);                boolean selected = list.isSelectedIndex(i);                d.append("<option value=\"").append(i).append("\"");                if (selected)                    d.append(" selected=\"selected\">");                else                    d.append(">");                SComponent renderer                    = cellRenderer.getListCellRendererComponent(list, o, false, i);                rendererPane.writeComponent(d, renderer, list);                d.append("</option>\n");            }        }    }