01: package com.xoetrope.carousel.services.dialog;
02:
03: import java.awt.GridLayout;
04: import java.awt.event.ActionEvent;
05: import java.awt.event.ActionListener;
06: import javax.swing.JButton;
07: import javax.swing.JDialog;
08: import javax.swing.JLabel;
09: import javax.swing.JTextField;
10:
11: /**
12: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
13: * the GNU Public License (GPL), please see license.txt for more details. If
14: * you make commercial use of this software you must purchase a commercial
15: * license from Xoetrope.</p>
16: * <p> $Revision: 1.2 $</p>
17: */
18: public class NewStaticSource extends JDialog implements ActionListener {
19: private JTextField txtSourceName, txtFileName;
20: private JButton btnOK, btnCancel;
21: private boolean ret;
22:
23: public NewStaticSource() {
24: getContentPane().setLayout(new GridLayout(3, 2));
25: txtSourceName = new JTextField();
26: txtFileName = new JTextField();
27: btnOK = new JButton("OK");
28: btnCancel = new JButton("Cancel");
29: btnOK.addActionListener(this );
30: btnCancel.addActionListener(this );
31:
32: getContentPane().add(new JLabel("Datasource name : "));
33: getContentPane().add(txtSourceName);
34: getContentPane().add(new JLabel("File name : "));
35: getContentPane().add(txtFileName);
36: getContentPane().add(btnOK);
37: getContentPane().add(btnCancel);
38: setSize(250, 100);
39: setModal(true);
40: }
41:
42: public String getSourceName() {
43: return txtSourceName.getText();
44: }
45:
46: public String getFileName() {
47: return txtFileName.getText();
48: }
49:
50: public boolean showDlg() {
51: setVisible(true);
52: ;
53: return ret;
54: }
55:
56: public void actionPerformed(ActionEvent evt) {
57: if (evt.getSource().equals(btnOK)) {
58: ret = true;
59: setVisible(false);
60: ;
61: } else {
62: ret = false;
63: setVisible(false);
64: }
65: }
66: }
|