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: import net.ar.webonswing.remote.*;
10:
11: public class PopupExample extends JDialog {
12: static int number;
13:
14: protected final class OpenDialogAction implements ActionListener,
15: RemoteListener {
16: public void actionPerformed(ActionEvent e) {
17: PopupExample popupExample = new PopupExample();
18: popupExample.setModal(true);
19: WosFramework.showChildWindow(PopupExample.this ,
20: popupExample);
21: }
22:
23: public String getRemoteName() {
24: return "OpenDialogListener";
25: }
26:
27: public Object[] getRemoteParameters() {
28: return new Object[] { number + "" };
29: }
30: }
31:
32: public PopupExample() {
33: JButton button = new JButton("open " + number);
34: button.addActionListener(new OpenDialogAction());
35:
36: final JButton incrementButton = new JButton("increment "
37: + number);
38: incrementButton.addActionListener(new ActionListener() {
39: public void actionPerformed(ActionEvent e) {
40: number++;
41: incrementButton.setText("increment " + number);
42: }
43: });
44:
45: final JButton closeButton = new JButton("close");
46: closeButton.addActionListener(new ActionListener() {
47: public void actionPerformed(ActionEvent e) {
48: WosFramework.hide(PopupExample.this );
49: }
50: });
51:
52: getContentPane().setLayout(new GridLayout(3, 1));
53: getContentPane().add(button);
54: getContentPane().add(incrementButton);
55: getContentPane().add(closeButton);
56:
57: Dimension dimension = new Dimension(100, 80);
58: getContentPane().setSize(dimension);
59: getRootPane().setSize(dimension);
60:
61: WosFramework.assignContributor(this ,
62: PopupExampleContributor.class);
63: }
64: }
|