Comments about Data problem when binding with db
creating simple own convertor is very easy. Here is very very very
simple convertor for jtextfield. Code is ugly and calls deprecated
methods, but it is just an example! 😀import java.util.Date;
import org.jdesktop.beansbinding.*;public class SimpleDateConverter extends Converter {
public Object convertForward(Object arg) {
return ((Date) arg).toGMTString();
}public Object convertReverse(Object arg) {
Date date = new Date();
date.setTime(Date.parse((String) arg));
return date;
}
}Setting convertor for textfield which is binded to Date jtable column is
also very easy…
– add convertor class into your project, compile file and drag and drop
it from project tree into your form.
– invoke Bind dialog for textfield (popup -> Bind -> text)
– change “Update Source When" to “Enter is pressed or focus is lost",
our convertor will convert only “final" value
– in Converter list select simpleConverter1 component, it is instance
of our drag-and-dropped converterAlso you can set converter without addding bean to form, just use “…"
button and use for example Custom Code property editor and call your
methods to get convertor instance.Now you should be able to modify Date value using textfield. But there
is no error handling, no validators, but this is another story.