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.*;

public class BeanTest extends Applet
{
   SBean bean;

   public static void main ( String[] args )
   {
      Frame f = new Frame( "BeanTest - SBean" );
      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 ()
   {
      ClassLoader myLoader;

      setBackground( Color.lightGray );
      add( new Label( "BeanTest - SBean" ) );
      try
      {
         myLoader = this.getClass().getClassLoader();
         bean = (SBean) Beans.instantiate( myLoader, "SBean" );
         add( bean );
      }
      catch ( Exception e )
      {  add( new Label( "Cannot instantiate the Bean!" ) );
         e.printStackTrace();
      }
   }
}




Send comments and mail to the WebMaster.