home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 November
/
Chip_1998-11_cd.bin
/
tema
/
Cafe
/
main.bin
/
vpojava.DLL
/
SOURCE
/
BEANINFO
< prev
next >
Wrap
Text File
|
1998-03-18
|
2KB
|
64 lines
import java.beans.*;
/*
** BeanInfo for JavaBean:
*/
public class JavaBeanBeanInfo extends SimpleBeanInfo
{
// getAdditionalBeanInfo method allows to return any number of additional
// BeanInfo objects which provide information about the Bean that this BeanInfo
// describes.
public BeanInfo[] getAdditionalBeanInfo()
{
try
{
BeanInfo[] bi = new BeanInfo[1];
bi[0] = Introspector.getBeanInfo(beanClass.getSuperclass());
return bi;
}
catch (IntrospectionException e) { throw new Error(e.toString());}
}
// getIcon returns an image object which can be used by toolboxes, toolbars
// to represent this bean. Icon images are in GIF format.
public java.awt.Image getIcon(int iconKind)
{
if (iconKind == BeanInfo.ICON_COLOR_16x16 ||
iconKind == BeanInfo.ICON_MONO_16x16)
{
java.awt.Image img = loadImage("JavaBeanIcon16.gif");
return img;
}
if (iconKind == BeanInfo.ICON_COLOR_32x32 ||
iconKind == BeanInfo.ICON_MONO_32x32)
{
java.awt.Image img = loadImage("JavaBeanIcon32.gif");
return img;
}
return null;
}
// getPropertyDescriptors returns an array of PropertyDescriptors which describe
// the editable properties of this bean.
public PropertyDescriptor[] getPropertyDescriptors()
{
try
{
PropertyDescriptor releasedColor = new PropertyDescriptor("releasedColor", beanClass);
PropertyDescriptor pressedColor = new PropertyDescriptor("pressedColor", beanClass);
releasedColor.setBound(true);
releasedColor.setDisplayName("Released Color");
pressedColor.setBound(true);
pressedColor.setDisplayName("Pressed Color");
PropertyDescriptor rv[] = {releasedColor, pressedColor};
return rv;
}
catch (IntrospectionException e)
{
throw new Error(e.toString());
}
}
private final static Class beanClass = JavaBean.class;
}