tab.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { System.out.println(tab.getSession().getServletRequest().getSession().getId() + " example = " + tab.getSelectedIndex()); } });
    public WingSet() {        frame = new SFrame("WingSet");        frame.setTitle("WingSet Demo");                // import additional templates        frame.addHeader(new Link("stylesheet", null, "text/css", null, new ClasspathResource("/wingset/css/myapp.css", "text/css")));               System.out.println("new WingSet");        stopWatch = new TimeMeasure(new MessageFormat("<html><b>{0}</b>: {1} (<i>x {2}</i>)<br/>"));        timeMeasure = new SLabel();        SContainer contentPane = frame.getContentPane();        try {            URL templateURL = getClass().getResource("/wingset/templates/ExampleFrame.thtml");            if (templateURL != null) {                SRootLayout layout = new SRootLayout(templateURL);                frame.setLayout(layout);            }        }        catch ( java.io.IOException except ) {            except.printStackTrace();        }                //SForm form = new SForm();        final STabbedPane tab = new STabbedPane();        tab.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent e) {                System.out.println(tab.getSession().getServletRequest().getSession().getId() +                                   " example = " + tab.getSelectedIndex());            }        });        tab.setName("examples");        // tab.setMaxTabsPerLine(9);        tab.setTabPlacement(STabbedPane.TOP);		tab.setBackgroundImage(brushedMetal);        tab.add(new WingsImage(), "wingS!");        tab.add(new LabelExample(), "Label");        tab.add(new BorderExample(), "Border");        tab.add(new TextComponentExample(), "Text Component");         // a Tab with icon..        tab.addTab("Tree", JAVA_CUP_ICON,                    new TreeExample(), "Tree Tool Tip");        tab.add(new OptionPaneExample(frame), "OptionPane");        tab.add(new TableExample(), "Table");        tab.add(new ListExample(), "List");        tab.add(new ButtonExample(), "Button");        tab.add(new ToggleButtonExample(), "ToggleButton");        tab.add(new CheckBoxExample(), "CheckBox");        tab.add(new RadioButtonExample(), "RadioButton");        tab.add(new Faces(), "Faces");        tab.add(new FileChooserExample(), "FileChooser");        tab.add(new ScrollPaneExample(), "ScrollPane");        tab.add(new PageScrollerExample(), "PageScroller");        tab.add(new MenuExample(), "Menue");        tab.add(new TabbedPaneExample(), "Tabbed Pane");        //tab.add(new LayoutExample(), "Simple Layout");        tab.addTab("Template Layout",                    SMALL_COW_ICON,                    new TemplateExample(), "Template Layout Manager");        tab.add(new InteractiveTemplateExample(), "Interactive Template");        tab.add(new ProgressBarExample(), "ProgressBar");        tab.add(new DateChooserExample(), "DateChooser");        tab.add(new MemUsageExample(), "Memory Usage");        tab.add(new JavaScriptListenerExample(), "Script Listener");        //tab.add(new DateChooserExample(), "DateChooser");        //form.add(tab);        // contentPane.add(form, "WingSetApp");        contentPane.add(tab, "WingSetApp");        contentPane.add(timeMeasure, "TimeLabel");        frame.show();        /*  for testing purpose, to get information what events are requested        final SLabel paramLabel = new SLabel();        contentPane.add(paramLabel, "ParamLabel");        SessionManager.getSession().addRequestListener(new SRequestListener() {                public void processRequest(SRequestEvent e) {                    if ( e.getType()==SRequestEvent.DISPATCH_START ) {                        StringBuffer label = new StringBuffer();                        HttpServletRequest req =                             SessionManager.getSession().getServletRequest();                                                for (Enumeration en = req.getParameterNames(); en.hasMoreElements();) {                            String paramName = (String)en.nextElement();                            String[] value = req.getParameterValues(paramName);                            label.append(paramName).append(": ").                                append(value[0]).append("<br>");                        }                        paramLabel.setText(label.toString());                    }                }            });        */    }    