Download this source file


// BeanInfo support class for SBean.java.  This class is used to tell the
// design tool which properties, methods, and events are to be exposed at
// design time.  It also allows us to associate an icon (4 versions) with
// the bean, for display in the design tool.
// In this case we expose only a single property, "theColor".  Since
// other properties (from java.awt.Component) are inherited, these must
// be explicitly hidden using a BeanInfo class.
//
// Written 2000 by Wayne Pollock, Tampa Florida USA.

import java.beans.*;
import java.awt.*;

public class SBeanBeanInfo extends SimpleBeanInfo
{
   public Image getIcon ( int iconType )
   {
      switch ( iconType )
      {
         case ICON_MONO_16x16:
            return loadImage( "SBeanIcon16.gif" );
         case ICON_MONO_32x32:
            return loadImage( "SBeanIcon32.gif" );
         case ICON_COLOR_16x16:
            return loadImage( "SBeanIcon16c.gif" );
         case ICON_COLOR_32x32:
            return loadImage( "SBeanIcon32c.gif" );
         default:
            return null;
      }
   }

   public PropertyDescriptor[] getPropertyDescriptors ()
   {
      try
      {
         PropertyDescriptor theColor =
           new PropertyDescriptor( "theColor", SBean.class, "gettheColor", "settheColor" );
           theColor.setPreferred( true );
           theColor.setShortDescription( "The Color of this Bean" );
         PropertyDescriptor bg =
           new PropertyDescriptor( "background", SBean.class );
           bg.setHidden( true );
         PropertyDescriptor fg=
           new PropertyDescriptor( "foreground", SBean.class );
           fg.setHidden( true );
         PropertyDescriptor name =
           new PropertyDescriptor( "name", SBean.class );
           name.setHidden( true );
         PropertyDescriptor font =
           new PropertyDescriptor( "font", SBean.class );
           font.setHidden( true );

      PropertyDescriptor props[] = { theColor, bg, fg, name, font };
      return props;

      }
      catch ( IntrospectionException e )
      {  System.err.println( e.toString() );  }

      return null;
   }
}




Send comments and mail to the WebMaster.