KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > editor > app > core > TextFrame


1 /*
2  * TextFrame.java
3  *
4  * Created on December 10, 2002, 5:13 PM
5  */

6
7 package org.netbeans.test.editor.app.core;
8
9 /**
10  *
11  * @author eh103527
12  */

13 public class TextFrame extends javax.swing.JFrame JavaDoc {
14     
15     /** Creates new form TextFrame */
16     public TextFrame() {
17         initComponents();
18     }
19     
20     /** This method is called from within the constructor to
21      * initialize the form.
22      * WARNING: Do NOT modify this code. The content of this method is
23      * always regenerated by the Form Editor.
24      */

25     private void initComponents() {//GEN-BEGIN:initComponents
26
jPanel1 = new javax.swing.JPanel JavaDoc();
27         editor = new javax.swing.JTextArea JavaDoc();
28         field = new javax.swing.JTextField JavaDoc();
29         jPanel2 = new javax.swing.JPanel JavaDoc();
30         writeB = new javax.swing.JButton JavaDoc();
31
32         addWindowListener(new java.awt.event.WindowAdapter JavaDoc() {
33             public void windowClosing(java.awt.event.WindowEvent JavaDoc evt) {
34                 exitForm(evt);
35             }
36         });
37
38         jPanel1.setLayout(new java.awt.BorderLayout JavaDoc());
39
40         jPanel1.add(editor, java.awt.BorderLayout.CENTER);
41
42         jPanel1.add(field, java.awt.BorderLayout.SOUTH);
43
44         getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
45
46         writeB.setText("Write");
47         writeB.addActionListener(new java.awt.event.ActionListener JavaDoc() {
48             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
49                 writeBActionPerformed(evt);
50             }
51         });
52
53         jPanel2.add(writeB);
54
55         getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH);
56
57         pack();
58     }//GEN-END:initComponents
59

60     private void writeBActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_writeBActionPerformed
61
// Add your handling code here:
62
System.out.println(editor.getText());
63         field.setText(editor.getText());
64         System.out.println(field.getText());
65         System.out.println("*******************");
66         System.out.println(editor.getDocument());
67         System.out.println(field.getDocument());
68     }//GEN-LAST:event_writeBActionPerformed
69

70     /** Exit the Application */
71     private void exitForm(java.awt.event.WindowEvent JavaDoc evt) {//GEN-FIRST:event_exitForm
72
System.exit(0);
73     }//GEN-LAST:event_exitForm
74

75     /**
76      * @param args the command line arguments
77      */

78     public static void main(String JavaDoc args[]) {
79         new TextFrame().show();
80     }
81     
82     
83     // Variables declaration - do not modify//GEN-BEGIN:variables
84
private javax.swing.JButton JavaDoc writeB;
85     private javax.swing.JPanel JavaDoc jPanel2;
86     private javax.swing.JTextArea JavaDoc editor;
87     private javax.swing.JPanel JavaDoc jPanel1;
88     private javax.swing.JTextField JavaDoc field;
89     // End of variables declaration//GEN-END:variables
90

91 }
92
Popular Tags