1 6 7 package org.netbeans.test.editor.app.core; 8 9 13 public class TextFrame extends javax.swing.JFrame { 14 15 16 public TextFrame() { 17 initComponents(); 18 } 19 20 25 private void initComponents() { jPanel1 = new javax.swing.JPanel (); 27 editor = new javax.swing.JTextArea (); 28 field = new javax.swing.JTextField (); 29 jPanel2 = new javax.swing.JPanel (); 30 writeB = new javax.swing.JButton (); 31 32 addWindowListener(new java.awt.event.WindowAdapter () { 33 public void windowClosing(java.awt.event.WindowEvent evt) { 34 exitForm(evt); 35 } 36 }); 37 38 jPanel1.setLayout(new java.awt.BorderLayout ()); 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 () { 48 public void actionPerformed(java.awt.event.ActionEvent evt) { 49 writeBActionPerformed(evt); 50 } 51 }); 52 53 jPanel2.add(writeB); 54 55 getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH); 56 57 pack(); 58 } 60 private void writeBActionPerformed(java.awt.event.ActionEvent evt) { 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 } 70 71 private void exitForm(java.awt.event.WindowEvent evt) { System.exit(0); 73 } 75 78 public static void main(String args[]) { 79 new TextFrame().show(); 80 } 81 82 83 private javax.swing.JButton writeB; 85 private javax.swing.JPanel jPanel2; 86 private javax.swing.JTextArea editor; 87 private javax.swing.JPanel jPanel1; 88 private javax.swing.JTextField field; 89 91 } 92 | Popular Tags |