FileDocCategorySizeDatePackage
LabelTextBeansDemo.javaAPI DocExample3228Mon May 31 22:51:38 BST 2004regress

LabelTextBeansDemo

public class LabelTextBeansDemo extends JFrame
Demo of LabelText JavaBean
author
Ian Darwin, http://www.darwinsys.com/
version
$Id: LabelTextBeansDemo.java,v 1.9 2004/06/01 02:51:37 ian Exp $

Fields Summary
private JPanel
jPanel1
private JButton
jButton1
private JButton
jButton2
private JPanel
jPanel2
private com.darwinsys.swingui.LabelText
bean1
private com.darwinsys.swingui.LabelText
bean2
Constructors Summary
public LabelTextBeansDemo()
Initializes the Form

    initComponents ();
    pack ();
  
Methods Summary
voidexitForm(java.awt.event.WindowEvent evt)
Exit the Application

//GEN-FIRST:event_exitForm
    System.exit (0);
  
private voidinitComponents()
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 FormEditor.

//GEN-BEGIN:initComponents
    addWindowListener (new java.awt.event.WindowAdapter () {
        public void windowClosing (java.awt.event.WindowEvent evt) {
          exitForm (evt);
        }
      }
    );
    getContentPane ().setLayout (new java.awt.BorderLayout ());

    jPanel1 = new javax.swing.JPanel ();
    jPanel1.setLayout (new java.awt.FlowLayout ());

      jButton1 = new javax.swing.JButton ();
      jButton1.setText ("Display");
      jButton1.addActionListener (new java.awt.event.ActionListener () {
          public void actionPerformed (java.awt.event.ActionEvent evt) {
            jButton1ActionPerformed (evt);
          }
        }
      );
      jPanel1.add (jButton1);

      jButton2 = new javax.swing.JButton ();
      jButton2.setText ("Exit");
      jButton2.addActionListener (new java.awt.event.ActionListener () {
          public void actionPerformed (java.awt.event.ActionEvent evt) {
            jButton2ActionPerformed (evt);
          }
        }
      );
      jPanel1.add (jButton2);

    getContentPane ().add (jPanel1, "South");

    jPanel2 = new javax.swing.JPanel ();
    jPanel2.setLayout (new javax.swing.BoxLayout (jPanel2, 1));

      bean1 = new LabelText ();
      bean1.setLabel ("Name:");
      jPanel2.add (bean1);

      bean2 = new LabelText ();
      bean2.setLabel ("Address:");
      jPanel2.add (bean2);

    getContentPane ().add (jPanel2, "Center");

  
voidjButton1ActionPerformed(java.awt.event.ActionEvent evt)

//GEN-FIRST:event_jButton1ActionPerformed
    String name = bean1.getText();
    String addr = bean2.getText();
    JOptionPane.showMessageDialog(this,
      "Name = " + name + "\n" +
      "Addr = " + addr,
      "Info",
      JOptionPane.INFORMATION_MESSAGE);
  
voidjButton2ActionPerformed(java.awt.event.ActionEvent evt)

//GEN-FIRST:event_jButton2ActionPerformed
    System.exit(0);
  
public static voidmain(java.lang.String[] args)

    new LabelTextBeansDemo().setVisible(true);