Defining a Simple Property Editor
A bean can also provide auxiliary
PropertyEditor classes for use by a beanbox
PropertyEditor is a flexible
interface that allows a bean to tell a beanbox how to display and edit
the values of certain types of properties.
A beanbox tool always provides simple property editors
for common property types, such as strings, numbers, fonts, and
colors. If your bean has a property of a nonstandard type, however,
you should register a property editor for that type. The easiest way
to “register” a property editor is through a simple naming convention.
If your type is defined by the class
editor for it should be defined in the class
Editor. Alternatively, you can register a
property editor by calling the
method, probably from the constructor of your
BeanInfo class. If you call this method from
the bean itself, the bean then depends on the property editor class,
so the editor has to be bundled with the bean in applications, which
is not desirable. Another way to register a property editor is by
BeanInfo class to specify the
PropertyEditor for a specific
class does this for the
property, for example.
PropertyEditor interface can seem confusing at first. Its methods allow you to define three techniques for displaying the value of a property and two techniques for allowing the user to edit the value of a property. ...