All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----java.beans.SimpleBeanInfo | +----java.awt.swing.beaninfo.SwingBeanInfo
getIcon
and
getDefaultPropertyIndex
as well as utility
methods, like createPropertyDescriptor, for writing BeanInfo
implementations. This classes is intended to be used along
with GenSwingBeanInfo
a BeanInfo class code generator.
public static final String BOUND
public static final String CONSTRAINED
public static final String PROPERTYEDITORCLASS
public static final String READMETHOD
public static final String WRITEMETHOD
public static final String DISPLAYNAME
public static final String EXPERT
public static final String HIDDEN
public static final String PREFERRED
public static final String SHORTDESCRIPTION
public static final String CUSTOMIZERCLASS
public SwingBeanInfo()
protected void throwError(Exception e, String s)
public PropertyDescriptor createPropertyDescriptor(Class cls, String name, Object[] args)
createPropertyDescriptor("contentPane", new Object[] { BOUND, Boolean.TRUE, CONSTRAINED, Boolean.TRUE, PROPERTYEDITORCLASS, package.MyEditor.class, READMETHOD, "getContentPane", WRITEMETHOD, "setContentPane", DISPLAYNAME, "contentPane", EXPERT, Boolean.FALSE, HIDDEN, Boolean.FALSE, PREFERRED, Boolean.TRUE, SHORTDESCRIPTION, "A top level window with a window manager border", "random attribute","random object value" } );The keywords correspond to
java.beans.PropertyDescriptor
and
java.beans.FeatureDescriptor
properties, e.g. providing a value
for displayName is comparable to FeatureDescriptor.setDisplayName()
.
Using createPropertyDescriptor instead of the PropertyDescriptor
constructor and set methods is preferrable in that it regularizes
the code in a java.beans.BeanInfo.getPropertyDescriptors()
method implementation. One can use createPropertyDescriptor
to set FeatureDescriptor
attributes, as in "random attribute"
"random object value".
All properties should provide a reasonable value for the
SHORTDESCRIPTION
keyword and should set BOUND
to Boolean.TRUE
if neccessary. The remaining keywords
are optional. There's no need to provide values for keywords like
READMETHOD if the correct value can be computed, i.e. if the properties
get/is method follows the standard beans pattern.
The PREFERRED keyword is not supported by the JDK1.1 java.beans package. It's still worth setting it to true for properties that are most likely to be interested to the average developer, e.g. AbstractButton.title is a preferred property, AbstractButton.focusPainted is not.
public BeanDescriptor createBeanDescriptor(Class cls, Object[] args)
createPropertyDescriptor("contentPane", new Object[] { CUSTOMIZERCLASS, package.MyCustomizer.class, DISPLAYNAME, "contentPane", EXPERT, Boolean.FALSE, HIDDEN, Boolean.FALSE, PREFERRED, Boolean.TRUE, SHORTDESCRIPTION, "A top level window with a window manager border", "random attribute","random object value" } );The keywords correspond to
java.beans.BeanDescriptor
and
java.beans.FeatureDescriptor
properties, e.g. providing a value
for displayName is comparable to FeatureDescriptor.setDisplayName()
.
Using createBeanDescriptor instead of the BeanDescriptor
constructor and set methods is preferrable in that it regularizes
the code in a java.beans.BeanInfo.getBeanDescriptor()
method implementation. One can use createBeanDescriptor
to set FeatureDescriptor
attributes, as in "random attribute"
"random object value".
public int getDefaultPropertyIndex()
public Image getIcon(int kind)
public BeanInfo[] getAdditionalBeanInfo()
All Packages Class Hierarchy This Package Previous Next Index