01: package net.ar.webonswing.tutorial;
02:
03: import java.awt.*;
04: import java.awt.event.*;
05:
06: import javax.swing.*;
07:
08: import net.ar.webonswing.*;
09:
10: public class LoginExample extends JDialog {
11: protected JLabel label = new JLabel("");
12:
13: public LoginExample() {
14: JButton topSecret = new JButton("Login here!");
15: topSecret.addActionListener(new ActionListener() {
16: public void actionPerformed(ActionEvent aE) {
17: if (WosFramework.getSessionContext().get("user") == null) {
18: Login loginWindow = new Login();
19: loginWindow.setModal(true);
20: WosFramework.showAndExecute(LoginExample.this ,
21: loginWindow, "processLogin");
22: } else
23: label.setText("Welcome again!!!");
24: }
25: });
26:
27: getContentPane().setLayout(new GridLayout(0, 1));
28: getContentPane().add(label);
29: getContentPane().add(topSecret);
30: }
31:
32: public void processLogin(Login aLoginWindow) {
33: label.setText("Welcome " + aLoginWindow.userField.getText()
34: + "!!!");
35: }
36: }
|