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: // - JOption: showinputdialog.
12: // dead code, optimisation of imports
13: /**
14: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
15: * the GNU Public License (GPL), please see license.txt for more details. If
16: * you make commercial use of this software you must purchase a commercial
17: * license from Xoetrope.</p>
18: * <p> $Revision: 1.3 $</p>
19: */
20: public class ModelFileEditor extends JDialog implements ActionListener {
21: private JTextField txtFileName;
22: private JButton btnOK, btnCancel;
23: private boolean ret;
24:
25: public ModelFileEditor() {
26: getContentPane().setLayout(new GridLayout(2, 2));
27: txtFileName = new JTextField();
28: btnOK = new JButton("OK");
29: btnCancel = new JButton("Cancel");
30: btnOK.addActionListener(this );
31: btnCancel.addActionListener(this );
32:
33: getContentPane().add(new JLabel("File name : "));
34: getContentPane().add(txtFileName);
35: getContentPane().add(btnOK);
36: getContentPane().add(btnCancel);
37: setSize(250, 100);
38: setModal(true);
39: }
40:
41: public String getFileName() {
42: return txtFileName.getText();
43: }
44:
45: public boolean showDlg(String file) {
46: txtFileName.setText(file);
47: setVisible(true);
48: return ret;
49: }
50:
51: public void actionPerformed(ActionEvent evt) {
52: if (evt.getSource().equals(btnOK)) {
53: ret = true;
54: setVisible(false);
55: } else {
56: ret = false;
57: setVisible(false);
58: }
59: }
60:
61: }
|