Property Editor

2 views
Skip to first unread message

Gert

unread,
Aug 21, 2009, 3:43:51 AM8/21/09
to BeJUG
Hi all,

I’m struggling a little bit with the coding of a property editor (aka
property inspector).
I’m trying to achieve it via the Bean Api. I retrieve the properties
via Introspection and Bean Info classes but for the next step:
displaying the properties in a property editor I could use some help.

Some code.....
public PropertyDescriptor[] getPropertyDescriptors() {
try {
PropertyDescriptor propertyDescriptor[] = new
PropertyDescriptor[2];
PropertyDescriptor pd = new PropertyDescriptor("id",
beanClass);
propertyDescriptor[0] = pd;
pd = new PropertyDescriptor("description", beanClass);
propertyDescriptor[1] = pd;
return propertyDescriptor;
} catch (IntrospectionException e) {
throw new Error(e.toString());
}
}

So, It is possible do define custom editors on the properties but
since it are all Strings I don’t need them. My first question do I
always have to specify the property editor class? (In my case String)

Question two: how can I render these properties in a user interface
(swing) using the property editors? I’ve also asked it to my good old
friend Google but has no clue either :-)

Regards,
Gert
Reply all
Reply to author
Forward
0 new messages