FileDocCategorySizeDatePackage
ChartBeanInfo.javaAPI DocExample1528Sat Oct 26 09:53:38 BST 2002com.darwinsys.charts

ChartBeanInfo

public class ChartBeanInfo extends SimpleBeanInfo
BeanInfo for our Chart Demo

Fields Summary
Constructors Summary
Methods Summary
public java.beans.BeanDescriptorgetBeanDescriptor()
Give a descriptor for the Bean itself

		return new BeanDescriptor(Chart.class);
	
public java.awt.ImagegetIcon(int kind)
Set the Icon for display in the BeanBox

		switch(kind) {
		case ICON_COLOR_16x16:
			return loadImage("ChartIcon16.gif");
		case ICON_COLOR_32x32:
			return loadImage("ChartIcon32.gif");
		case ICON_MONO_16x16:
			return loadImage("ChartIconBW16.gif");
		case ICON_MONO_32x32:
			return loadImage("ChartIconBW32.gif");
		default:
			System.out.println("ChartBean Unsupported Icon Format " + kind);
		}
		return null;
	
public java.beans.MethodDescriptor[]getMethodDescriptors()
Set up the method name descriptions for actions

		try {
			// DODEMO()
			Method m = Chart.class.getMethod("doDemo", new Class[] {});
			MethodDescriptor md1 = new MethodDescriptor(m);
			md1.setShortDescription("Run a simple demonstration");

			// SETDATA(ChartData[]);
			Class argTypes[] = { Class.forName("ChartData[]") };
			m = Chart.class.getMethod("setData", argTypes);
			MethodDescriptor md2 = new MethodDescriptor(m);
			md2.setShortDescription("Provide array of ChartData to plot");

			return new MethodDescriptor[] { md1, md2 };

		} catch (Exception e) {		// if anything fails, fall back to default
			System.out.println(e);
			return super.getMethodDescriptors();
		}