01: package net.xoetrope.builder.editor.dialog;
02:
03: import java.awt.event.ActionEvent;
04: import java.awt.event.ActionListener;
05: import javax.swing.JButton;
06: import javax.swing.JDialog;
07: import javax.swing.JLabel;
08: import javax.swing.JTextField;
09: import net.xoetrope.xui.XPage;
10: import net.xoetrope.xui.XComponentFactory;
11:
12: /**
13: * A dialog for the New Screen parameters
14: * <p>Copyright: Copyright (c) Xoetrope Ltd., 1998-2003</p>
15: * $Revision: 1.5 $
16: */
17: public class XNewPageDialog extends JDialog implements ActionListener {
18:
19: JTextField txtScreenName;
20: JButton btnOK, btnCancel;
21: String screenName;
22:
23: public XNewPageDialog() {
24: getContentPane().setLayout(null);
25: setModal(true);
26: setTitle("New Page");
27:
28: XComponentFactory factory = new XComponentFactory(
29: XPage.XUI_SWING_PACKAGE);
30: factory.setParentComponent(getContentPane());
31:
32: JLabel lbl = (JLabel) factory.addComponent(XPage.LABEL, 10, 10,
33: 200, 20, "Enter the name of the new page!");
34:
35: txtScreenName = (JTextField) factory.addComponent(XPage.EDIT,
36: 10, 35, 200, 20, "");
37:
38: btnOK = (JButton) factory.addComponent(XPage.BUTTON, 20, 60,
39: 60, 20, "OK");
40: btnCancel = (JButton) factory.addComponent(XPage.BUTTON, 110,
41: 60, 60, 20, "Cancel");
42:
43: btnOK.addActionListener(this );
44: btnCancel.addActionListener(this );
45:
46: setSize(220, 100);
47: }
48:
49: public String getScreenName() {
50: show();
51: return screenName;
52: }
53:
54: public void actionPerformed(ActionEvent evt) {
55: if (evt.getSource().equals(btnOK))
56: screenName = txtScreenName.getText();
57: else
58: screenName = null;
59:
60: hide();
61: }
62: }
|