if (showAsFormComponent) device.print("</button>"); else
if (showAsFormComponent) { writeButtonEnd(device); } else {
    private void writeTabs(Device device, STabbedPane tabbedPane) throws IOException {        boolean childSelectorWorkaround = !tabbedPane.getSession().getUserAgent().supportsCssChildSelector();        boolean showAsFormComponent = tabbedPane.getShowAsFormComponent();        final Browser browser = tabbedPane.getSession().getUserAgent();        // substitute whitespaces for konqueror and ie5.0x        boolean nbspWorkaround = browser.getBrowserType().equals(                BrowserType.KONQUEROR)                || (browser.getBrowserType().equals(BrowserType.IE)                        && browser.getMajorVersion() == 5 && browser                        .getMinorVersion() <= .1);        for (int i = 0; i < tabbedPane.getTabCount(); i++) {            SIcon icon = tabbedPane.getIconAt(i);            String title = tabbedPane.getTitleAt(i);            String tooltip = tabbedPane.getToolTipText();            if (nbspWorkaround)                title = Utils.nonBreakingSpaces(title);                        /*             * needed here so that the tabs can be wrapped. else they are in             * one long line. noticed in firefox and konqueror.             */            device.print("\n");                        if (showAsFormComponent)                device.print("<button name=\"")                        .print(Utils.event(tabbedPane))                        .print("\" value=\"")                        .print(i)                        .print("\"");            else                device.print("<a href=\"")                        .print(tabbedPane.getRequestURL()                        .addParameter(Utils.event(tabbedPane) + "=" + i).toString())                        .print("\"");            if (i == tabbedPane.getSelectedIndex()) {                device.print(" selected=\"true\"");                if (tabbedPane.isFocusOwner())                    Utils.optAttribute(device, "focus", tabbedPane.getName());            }            if (!tabbedPane.isEnabledAt(i))                device.print(" disabled=\"true\"");            if (childSelectorWorkaround) {                String cssClassName = "STabbedPane_Tab_" + placements.get(new Integer(tabbedPane.getTabPlacement()));                if (i == tabbedPane.getSelectedIndex()) {                    Utils.childSelectorWorkaround(device, cssClassName + " STabbedPane_Tab_selected");                } else if (!tabbedPane.isEnabledAt(i)) {                    Utils.childSelectorWorkaround(device, cssClassName + " STabbedPane_Tab_disabled");                } else {                    Utils.childSelectorWorkaround(device, cssClassName);                }            }            device.print(">");            if (icon != null && tabbedPane.getTabPlacement() != STabbedPane.RIGHT) {                device.print("<img");                Utils.optAttribute(device, "src", icon.getURL());                Utils.optAttribute(device, "alt", tooltip);                Utils.optAttribute(device, "width", icon.getIconWidth());                Utils.optAttribute(device, "height", icon.getIconHeight());                device.print(" style=\"margin-left:0.2em;\"/>");            }            device.print("&nbsp;");            Utils.write(device, title);            device.print("&nbsp;");            if (icon != null && tabbedPane.getTabPlacement() == STabbedPane.RIGHT) {                device.print("&nbsp;<img");                Utils.optAttribute(device, "src", icon.getURL());                Utils.optAttribute(device, "alt", tooltip);                Utils.optAttribute(device, "width", icon.getIconWidth());                Utils.optAttribute(device, "height", icon.getIconHeight());                device.print("/>");            }            if (showAsFormComponent)                device.print("</button>");            else                device.print("</a>");        }    }