I'm sure this will seem like a silly question after somebody answers it. I'm walking through the PetClinic sample to figure out how the framework operates, and am confused by something I find in the form classes.
In the following class:
org.springframework.richclient.samples.petclinic.u i.OwnerGeneralForm
My question:Code:protected JComponent createFormControl() { FormLayout layout = new FormLayout("left:pref, 5dlu, pref:grow"); BeanFormBuilder formBuilder = new JGoodiesBeanFormBuilder( getFormModel(), layout); this.firstNameField = formBuilder.add("firstName")[1]; formBuilder.add("lastName"); return formBuilder.getForm(); }
When adding the first field, why is the component in index 1 of the array returned by formBuilder saved to a local variable? It isn't done for subseqeunt text boxes, and from what I can tell the stored value is never used. I commented the code out so that it was:
And it seemed to work. Yet, all of the forms follow the first example - including the login form in the security package. I'm sure there must be a reason, I just can't figure it out.Code:formBuilder.add("firstName"); formBuilder.add("lastName"); return formBuilder.getForm();
Help.
-Dave



Reply With Quote