tags:

views:

67

answers:

2

I have a java object with several members. I want to create a small, quick and dirty editor that allows me to set the value of the members in an easy way. I've created a Panel that contains a TextField for every member. I have a setValues() method that will take the value of the TextFields and set them into the object. This method is automatically invoked when I call getDataObject() from the panel. Some of the members contain Strings, some others are doubles and some are integers. Nothing fancy.

The question is, however, what would be the easier way to improve this Panel? How can I add some validation without having to manually check every value? How can I do this without having to write a huge amount of code? At the moment my quick and very dirty implementation just propagates the RuntimeException, but of course this is only temporary.

Before I set myself to write all this code, I wondered what would be the best pattern, or if there is some library available to perform such operations, as this seems to be a relatively commmon use case. In other words, if there is a lazy way out.

+1  A: 

Quihubole Mario! :)

I've read sometime ago about this library from JGoodies, but to be honest I don't know if it is related or not.

JGoodies Binding

Take a look at it and see if it helps.

OscarRyz
+1  A: 

Take a look at property editor at http://www.l2fprod.com/common/