alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 * TextFrame.java
 *
 * Created on December 10, 2002, 5:13 PM
 */

package org.netbeans.test.editor.app.core;

/**
 *
 * @author  eh103527
 */
public class TextFrame extends javax.swing.JFrame {
    
    /** Creates new form TextFrame */
    public TextFrame() {
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents() {//GEN-BEGIN:initComponents
        jPanel1 = new javax.swing.JPanel();
        editor = new javax.swing.JTextArea();
        field = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        writeB = new javax.swing.JButton();

        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                exitForm(evt);
            }
        });

        jPanel1.setLayout(new java.awt.BorderLayout());

        jPanel1.add(editor, java.awt.BorderLayout.CENTER);

        jPanel1.add(field, java.awt.BorderLayout.SOUTH);

        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);

        writeB.setText("Write");
        writeB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                writeBActionPerformed(evt);
            }
        });

        jPanel2.add(writeB);

        getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH);

        pack();
    }//GEN-END:initComponents

    private void writeBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_writeBActionPerformed
        // Add your handling code here:
        System.out.println(editor.getText());
        field.setText(editor.getText());
        System.out.println(field.getText());
        System.out.println("*******************");
        System.out.println(editor.getDocument());
        System.out.println(field.getDocument());
    }//GEN-LAST:event_writeBActionPerformed
    
    /** Exit the Application */
    private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
        System.exit(0);
    }//GEN-LAST:event_exitForm
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        new TextFrame().show();
    }
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton writeB;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JTextArea editor;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JTextField field;
    // End of variables declaration//GEN-END:variables
    
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.