SForm form = new SForm(new SGridLayout(2));
SGridLayout gridLayout = new SGridLayout(2); gridLayout.setCellPadding(4);  SForm form = new SForm(gridLayout);
    public SComponent createExample() {        SPanel p = new SPanel();        p.add(new SLabel("The client side can handle simple events by JavaScript listeners. In this example, numbers are added locally."));        final STextField firstField = createNumberField();        final STextField secondField = createNumberField();        final STextField sumField = createNumberField();        SButton serverCalcButton = new SButton("sum");        firstField.setFocusTraversalIndex(1);        secondField.setFocusTraversalIndex(2);        SForm form = new SForm(new SGridLayout(2));        form.add(new SLabel("Value #1"));        form.add(firstField);        form.add(new SLabel("Value #2"));        form.add(secondField);        form.add(new SLabel("Sum"));        form.add(sumField);        form.add(new SLabel("Server calculation"));        form.add(serverCalcButton);        /*         * The server side listener         */        serverCalcButton.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent ev) {                doCalculation(firstField, secondField, sumField);            }        });        /*         * add the client side script listener. The variables          * in curly braces are replaced by the actual IDs of the components.         */        SComponent[] jsParams = new SComponent[]{firstField, secondField,                                                 sumField};        JavaScriptListener jsListener;        jsListener = new JavaScriptListener(JavaScriptEvent.ON_CHANGE,                JS_ADD_SCRIPT,                jsParams);        firstField.addScriptListener(jsListener);        secondField.addScriptListener(jsListener);        // any change to the sum field: no way, recalculate from source fields        sumField.addScriptListener(jsListener);        p.add(form);        return p;    }