01: package testportlet;
02:
03: import java.awt.event.ActionEvent;
04: import java.awt.event.ActionListener;
05:
06: import org.wings.SButton;
07: import org.wings.SForm;
08: import org.wings.SFrame;
09: import org.wings.SGridLayout;
10: import org.wings.SLabel;
11: import org.wings.STextField;
12:
13: public class TestPortletWingS {
14:
15: public TestPortletWingS() {
16:
17: // Erstellung der HTML-Form mit einem GridLayout
18: SGridLayout gridLayout = new SGridLayout(1);
19: SForm panel = new SForm(gridLayout);
20: SButton submitButton = new SButton("Submit");
21: gridLayout.setVgap(10);
22:
23: final SLabel message = new SLabel();
24: final STextField textField = new STextField();
25:
26: // ActionListener für den Button
27: submitButton.addActionListener(new ActionListener() {
28: public void actionPerformed(ActionEvent e) {
29: message.setText("Hallo " + textField.getText() + " !");
30: }
31: });
32:
33: panel.add(new SLabel("Please insert name:"));
34: panel.add(textField);
35: panel.add(submitButton);
36: panel.add(message);
37:
38: SFrame rootFrame = new SFrame();
39: rootFrame.getContentPane().add(panel);
40: rootFrame.setVisible(true);
41:
42: }
43:
44: }
|