Download this source file


// Demonstration of Java Beans.
// (C) 2000 by Wayne Pollock, Tampa FL USA.
// All Rights Reserved.

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.beans.*;
import mybeans.*;

public class BeanTest extends Applet
{
   SimpleBean bean;
   public static void main ( String[] args )
   {
      Frame f = new Frame( "BeanTest - SimpleBean" );
      BeanTest me = new BeanTest();
        f.add( me, "Center" );
        me.init();
        me.start();
      f.pack();
      f.addWindowListener( new WindowAdapter()
          {  public void windowClosing ( WindowEvent we )
             {  System.exit( 0 );  }
          }
      );
      f.setVisible( true );
   }

   public void init ()
   {
      setBackground( Color.lightGray );
      add( new Label( "BeanTest - SimpleBean" ) );
      try
      {
         bean = (SimpleBean) Beans.instantiate( null, "mybeans.SimpleBean" );
         add( bean );
      }
      catch ( Exception e )
      {  add( new Label( "Cannot instantiate the Bean!" ) );
         e.printStackTrace();
      }
   }
}