KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > examples > texteditor > About


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package examples.texteditor;
21
22 public class About extends javax.swing.JDialog JavaDoc {
23
24     /** Initializes the Form */
25     public About(java.awt.Frame JavaDoc parent) {
26         super (parent, true);
27         initComponents ();
28         pack ();
29     }
30
31     /** This method is called from within the constructor to
32      * initialize the form.
33      * WARNING: Do NOT modify this code. The content of this method is
34      * always regenerated by the FormEditor.
35      */

36     private void initComponents() {//GEN-BEGIN:initComponents
37
jTextField1 = new javax.swing.JTextField JavaDoc();
38         jMenuBar1 = new javax.swing.JMenuBar JavaDoc();
39         jMenu1 = new javax.swing.JMenu JavaDoc();
40         jMenuItem1 = new javax.swing.JMenuItem JavaDoc();
41
42         setTitle("About");
43         addWindowListener(new java.awt.event.WindowAdapter JavaDoc() {
44             public void windowClosing(java.awt.event.WindowEvent JavaDoc evt) {
45                 closeDialog(evt);
46             }
47         });
48
49         jTextField1.setEditable(false);
50         jTextField1.setText("Ted the Text Editor.");
51         getContentPane().add(jTextField1, java.awt.BorderLayout.CENTER);
52
53         jMenu1.setText("About");
54         jMenuItem1.setText("Close");
55         jMenuItem1.addActionListener(new java.awt.event.ActionListener JavaDoc() {
56             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
57                 jMenuItem1ActionPerformed(evt);
58             }
59         });
60
61         jMenu1.add(jMenuItem1);
62         jMenuBar1.add(jMenu1);
63         setJMenuBar(jMenuBar1);
64
65     }//GEN-END:initComponents
66

67     private void jMenuItem1ActionPerformed (java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
68
// Add your handling code here:
69
closeDialog(null);
70     }//GEN-LAST:event_jMenuItem1ActionPerformed
71

72
73     /** Closes the dialog */
74     private void closeDialog(java.awt.event.WindowEvent JavaDoc evt) {//GEN-FIRST:event_closeDialog
75
setVisible (false);
76         dispose ();
77     }//GEN-LAST:event_closeDialog
78

79
80     // Variables declaration - do not modify//GEN-BEGIN:variables
81
private javax.swing.JTextField JavaDoc jTextField1;
82     private javax.swing.JMenuItem JavaDoc jMenuItem1;
83     private javax.swing.JMenuBar JavaDoc jMenuBar1;
84     private javax.swing.JMenu JavaDoc jMenu1;
85     // End of variables declaration//GEN-END:variables
86

87
88
89 }
90
Popular Tags