JavaBeans Section Index | Page 5
What is a customizer?
A customizer is a visual component used to configure all the properties of a JavaBean at once (or all those that the developer wishes to expose). It needs to subclass java.awt.Component and implem...more
What is a property editor?
A property editor allows you to customize a particular data type for a JavaBean component. Shown when selected from a property sheet of a builder tool, they implement the PropertyEditor interface ...more
What part of code in a JavaBean gets executed at design time?
In theory, any of it can. It all depends on the tool you are using. For instance, if you are designing your code in emacs/vi (an editor), then none of it. If instead, you are designing with an IDE...more
What are the main differences between JavaBeans and applets?
Applets are Java programs which are meant to be run by
an applet-runner (which is typically inside a web browser).
By definition, applets are applets because they inherit from
java.applet.Applet....more
Is it possible to create static properties/methods of a bean class? Does the beans spec cover this?
The JavaBeans Specification (available from http://java.sun.com/beans/docs/spec.html) specifies that properties are not static, as they are attributes of specific bean instances. There is nothing ...more
Where do I get the source code for the BeanBox of the Beans Development Kit?
When you installed the BDK, the source for the BeanBox is automatically placed under the beanbox directory, as in BDK1.1/beanbox/sun/beanbox and BDK1.1/beanbox/sunw/beanboxmore
How do I have my JavaBean display a custom icon when it is imported into a bean builder tool?
You need to create a custom BeanInfo class for your bean with a public Image getIcon(int kind) method to return the necessary icon. Predefined types are BeanInfo.ICON_MONO_16x16, BeanInfo.ICON_MON...more
Where does my bean builder tool look for BeanInfo classes for its beans?
Besides in the same package as the associated JavaBean component, the JavaBeans Introspector maintains a search path. This search path is initially the lone sun.beans.infos package. However, this ...more
How do I create a constrained property?
Constrained properties have the following pattern:
public TYPE getXXX()
public void setXXX(TYPE value)
throws PropertyVetoException
where PropertyVetoException is thrown if the validat...more
How do I define a JavaBeans property?
Properties are defined/identified/accessed by a pair of get / set methods:
public void setXXX(TYPE value);
public TYPE getXXX();
For example:
public void setMood(int mood) {
this.mood = mood...more
How do I define an indexed JavaBeans property?
Indexed properties support indexed, multi-valued collection. The index must be an integer, and the following accessor naming pattern defines an indexed property:
public void setXXX(int index, TYP...more
How do I make a JavaBeans property bound?
You need to implement a pair of methods to maintain list of property change listeners:
public void addPropertyChangeListener(PropertyChangeListener x)
public void removePropertyChangeListener(Pro...more
What is a bound JavaBeans property?
A bound property is one that wants to notify some other Bean/object of changes to said property.
What is a constrained property?
Constrained properties are properties that permit other objects to validate changes in value.
What is a JavaBeans property?
A property is a public attribute of a bean that affects appearance or behavior.
Typical attributes are like color, font, name, etc. They will usually be persistent and may be presented in a proper...more