KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sellwin > gui > DescEditorDialog


1 package sellwin.gui;
2
3 import javax.swing.*;
4 import javax.swing.border.*;
5 import java.awt.*;
6 import java.awt.event.*;
7
8 // SellWin http://sourceforge.net/projects/sellwincrm
9
//Contact support@open-app.com for commercial help with SellWin
10
//This software is provided "AS IS", without a warranty of any kind.
11

12 /**
13  * DescEditorDialog.java
14  * @author jmccormi
15  *
16  * Created on June 9, 2002
17  */

18 public class DescEditorDialog extends JDialog implements GUIChars {
19
20     private JPanel buttonPanel;
21     private JButton okButton;
22     private JPanel mainPanel;
23     private JScrollPane jScrollPane1;
24     private JTextArea descTextArea;
25
26     private final DescEditorDialogListener myEditor;
27
28     /** Creates new form DescEditorDialog */
29     public DescEditorDialog(Frame parent, DescEditorDialogListener editor) {
30         super(parent, "Description", true);
31         myEditor = editor;
32         initComponents();
33         setFonts();
34         setColors();
35         setLang();
36
37         okButton.addActionListener(
38             new ActionListener() {
39                 public void actionPerformed(ActionEvent e) {
40                     myEditor.setDesc(descTextArea.getText());
41                     hide();
42                 }
43             }
44         );
45
46         WindowListener l = new WindowAdapter() {
47             public void windowClosed(WindowEvent e) {
48             }
49
50             public void windowClosing(WindowEvent e) {
51                 hide();
52             }
53         };
54
55         addWindowListener(l);
56         getRootPane().setDefaultButton(okButton);
57     }
58
59     public final void setDesc(String JavaDoc d) {
60         descTextArea.setText(d);
61     }
62
63     public final String JavaDoc getDesc() {
64         return descTextArea.getText();
65     }
66
67
68     public void setColors() {
69     }
70
71     public void setLang() {
72     }
73
74     public void setFonts() {
75     }
76
77     /** This method is called from within the constructor to
78      * initialize the form.
79      * WARNING: Do NOT modify this code. The content of this method is
80      * always regenerated by the Form Editor.
81      */

82     private void initComponents() {
83         buttonPanel = new JPanel();
84         okButton = new JButton();
85         mainPanel = new JPanel();
86         jScrollPane1 = new JScrollPane();
87         descTextArea = new JTextArea();
88         
89         setTitle("Description");
90         addWindowListener(new WindowAdapter() {
91             public void windowClosing(WindowEvent evt) {
92                 closeDialog(evt);
93             }
94         });
95         
96         okButton.setText("Ok");
97         buttonPanel.add(okButton);
98         
99         getContentPane().add(buttonPanel, BorderLayout.SOUTH);
100         
101         mainPanel.setBorder(new EtchedBorder());
102         descTextArea.setColumns(40);
103         descTextArea.setRows(3);
104         descTextArea.setPreferredSize(new Dimension(480, 39));
105         descTextArea.setMaximumSize(new Dimension(270, 200));
106         descTextArea.setMinimumSize(new Dimension(270, 200));
107         jScrollPane1.setViewportView(descTextArea);
108         
109         mainPanel.add(jScrollPane1);
110         
111         getContentPane().add(mainPanel, BorderLayout.CENTER);
112         
113         pack();
114     }
115
116     /** Closes the dialog */
117     private void closeDialog(WindowEvent evt) {
118         setVisible(false);
119         dispose();
120     }
121 }
122
Popular Tags