String text = ((SMenuItem)menu.getMenuComponent(i)).getText();
SMenuItem item = (SMenuItem)menu.getMenuComponent(i); StringBuffer text = new StringBuffer(item.getText()); if (item.getAccelerator() != null) { text.append(" "); text.append(KeystrokeUtil.keyStroke2String(item.getAccelerator())); }
    protected void writeListAttributes(final Device device, SMenu menu) throws IOException {        if (menu.getParentMenu() != null) {            // calculate max length of children texts for sizing of layer            int maxLength = 0;            for (int i = 0; i < menu.getMenuComponentCount(); i++) {                if (!(menu.getMenuComponent(i) instanceof SMenuItem))                    continue;                String text = ((SMenuItem)menu.getMenuComponent(i)).getText();                if (text != null && text.length() > maxLength) {                    maxLength = text.length();                    if (menu.getMenuComponent(i) instanceof SMenu) {                            maxLength = maxLength + 2; //graphics                    }                }            }            device.print(" style=\"width:");            String stringLength = String.valueOf(maxLength * menu.getWidthScaleFactor());            device.print(stringLength.substring(0,stringLength.lastIndexOf('.')+2));            device.print("em;\"");        } else {            device.print(" id=\"");            device.print(menu.getName());            device.print("_pop\"");        }    }